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
    Khai
    0

    Umbraco richtexteditor apply styling css class to link

    Hey,

    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 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 29, 2013 @ 11:25
    Jan Skovgaard
    101

    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.

    /Jan

  • Jamie Attwood 210 posts 507 karma points c-trib
    Feb 18, 2014 @ 21:56
    Jamie Attwood
    1

    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!

    Thanks,

    Jamie

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies