Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Khai 71 posts 161 karma points
    Mar 28, 2013 @ 21:23

    Umbraco richtexteditor apply styling css class to link


    Can you apply a css class to a link with the rich texteditor of umbraco? I've already added a styling called "btn" to the richtexteditor. However whenever I want to apply it to a link like <a href="/" class="btn"> but it just adds a <p class="btn"> around the link. Is there any way to get this working?

  • Jan Skovgaard 11256 posts 23495 karma points MVP 7x admin c-trib
    Mar 29, 2013 @ 11:25
    Jan Skovgaard

    Hi Khai

    Unfortunately the rte is a bit weird when adding styling using classes. In some cases the class will be applied to the desired element, in some cases it will wrap either a span or p tag around the desired element with the class on it.

    This gives you the following options.

    1: Make sure that you take this into account in your stylesheet, so you write your rules like .btn, .btn a{yourstyleshere} - This way it's transparen to the editors and they don't get the feeling that they did something wrong.

    2: If it's only you who are in control of the site you could use the "html" button to edit the html manually making sure the class is placed directly on the a tag.

    Hope this helps.


  • Jamie Attwood 133 posts 346 karma points
    Feb 18, 2014 @ 21:56
    Jamie Attwood

    This is driving me slightly insane. I have 3 Umbraco instances where I absoutely need to be able to set classes on A tags. End users just can't deal with this seemingly. Questions:

    1) Is there anything I can modify in the code that will allow me to use the RTE so that at least when change a link on a link that already has a class assigned that it does not strip it? Currently if I use the RTE to set a link it will STRIP out any existing classes. Then I need to go back into HTML mode to re- add the class.

    2) Is there any plan for a Class addition to the insert link tool? Even if this is a plain text box, it would be better than nothing!



Please Sign in or register to post replies

Write your reply to: