The beauty of this is that you can inject this code into your whole site, individual pages, or collections. So for example a blog collection and ad collection could have different formatting. You could also use the <blockquote> tag for additional formatting if the client doesn’t need it. Although that’s not good practice for SEO or accessibility.
I’m trying to add something like button to the RTE in the CMS. I’ve tried putting your code in the Project settings > Custom Code > Header and Footer, and as HTML on the page, but nothing gives, I just get Bold. What am I doing wrong?
@Jonathan_Holden - There is no button element within a RTE. The only way to style an anchor to look like a button would be to use custom code to style all links, since there is no way to add a class to a link, in the RTE.
Sorry Jeff, I didn’t explain that properly. I don’t want a button at all. In fact I want Preformatted textanything I want to write hereA way of distinguishing some words from other textI will want some of it to say “button” as I am writing a blog about buttons and links. But I’ll also want to write things like <ahref>. As you can see, I can do it here, but I want to be able to do it in the CMS.
I have done this in RTE on a normal page by styling All boldsWhen nested inside of... but it doesn’t work in the CMS.
Since WhityG created this topic, new tools and techniques to style elements inside rich text elements now exist.
Refokus, an agency in the EU, created a a set of tools called “Refokus Tools” and among them is the Rich Text Enhancer.
Refokus states, “Use Refokus Rich Text Booster to add Classes, IDs, or Custom Attributes to rich text elements in Webflow so you can style text, anchor to it, add animations, add custom functionalities, and more.”
Finsweet, an agency in the US, created a tool called “Powerful Rich Text” as part of their Attributes tools. They state, “Add HTML to Rich Text elements, add components from the same page or from different pages, add classes, ids, attributes, and more.”
This worked great! Super cool, appreciate you sharing! Used Finsweet, just added in the script to the page header that I wanted it on, added the the custom attribute and then started writing in HTML. It worked! Pretty sure you need to be on the live site to see it though.