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?
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.
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!
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?
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
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
is working on a reply...