In the link dialog box in the main editing window, there is no field for a CSS class. Is it possible to add this somehow, as I need my client to be able to add a css class to certain link tags without delving into the HTML view?
There's no way to add a class from the link window but it can still be done without entering the HTML view. Have your client add the link by selecting link text and clicking the link button. Once the link is set, have them re-select the same text which selects the link tag. Then have them apply the css class by choosing the style from the styles dropdown on the toolbar. It's a 2 step process but it gets the job done. You will obviously have to add those link styles as properties to the style sheet and associate the style sheet with the RTE being used :)
Are the styles defined properly and are they selectable from the "styles" in the rich text editor? Could you please give a more thorough description of what you have done in order to try to get this working? Then it might be easier to figure out where things go wrong. :-)
Hi, yes the styles are selectable and are set up exactly as specified by Chris. If I apply the style to text it applies it correctly. When applied to an anchor it wraps it in a SPAN with the correct class name.
Yeah, that's a bit buggy because it will also insert a span in the <p> sometimes, with the class on it. But I guess this is just a matter of taking care of it in the CSS somehow making sure the link is properly styled if the span is wrapped around it.
Have you defined the class style in the class definition in Umbraco? I guess that it should work if you add the selectors and properties to your ordinary stylesheet.
(I'm guessing that the structure generated is <a href="#"><span class="yourclass">Text</span></a>, right?)
Ok, but that should be ok too i guess - it should really just be a matter of taking care of it in the css. Either it should catch span.yourclass a og just a.yourclass, right?
I know the ideal solution would be to not have the spans at all but sometimes one just needs to be pragmatic, right? :-)
Point taken - And if it was a customer site this is the appoach I would probably take. As this will be in a prominent position on the re-design of my site I will just edit the HTML as a want the HTML to look clean.
Set CSS class on link
Hi,
In the link dialog box in the main editing window, there is no field for a CSS class. Is it possible to add this somehow, as I need my client to be able to add a css class to certain link tags without delving into the HTML view?
Thanks
There's no way to add a class from the link window but it can still be done without entering the HTML view. Have your client add the link by selecting link text and clicking the link button. Once the link is set, have them re-select the same text which selects the link tag. Then have them apply the css class by choosing the style from the styles dropdown on the toolbar. It's a 2 step process but it gets the job done. You will obviously have to add those link styles as properties to the style sheet and associate the style sheet with the RTE being used :)
-Chris
I couldn't get this to work following the steps outlined by Chris (using 4.6.1)
Hi Paul
Are the styles defined properly and are they selectable from the "styles" in the rich text editor? Could you please give a more thorough description of what you have done in order to try to get this working? Then it might be easier to figure out where things go wrong. :-)
/Jan
Hi, yes the styles are selectable and are set up exactly as specified by Chris. If I apply the style to text it applies it correctly. When applied to an anchor it wraps it in a SPAN with the correct class name.
Hi Paul
Yeah, that's a bit buggy because it will also insert a span in the <p> sometimes, with the class on it. But I guess this is just a matter of taking care of it in the CSS somehow making sure the link is properly styled if the span is wrapped around it.
Have you defined the class style in the class definition in Umbraco? I guess that it should work if you add the selectors and properties to your ordinary stylesheet.
(I'm guessing that the structure generated is <a href="#"><span class="yourclass">Text</span></a>, right?)
/Jan
Hi,
No, it is generating it like <span class="yourclass"> <a href="#">Text</a></span>.
Fortunately, it is just for my own site so I am happy to edit the HTML directly.
Hi Paul
Ok, but that should be ok too i guess - it should really just be a matter of taking care of it in the css. Either it should catch span.yourclass a og just a.yourclass, right?
I know the ideal solution would be to not have the spans at all but sometimes one just needs to be pragmatic, right? :-)
/Jan
Hi Jan,
Point taken - And if it was a customer site this is the appoach I would probably take. As this will be in a prominent position on the re-design of my site I will just edit the HTML as a want the HTML to look clean.
Thanks
Paul
I have just added a work item here: http://umbraco.codeplex.com/workitem/30063
(Incidently the pop used in the editor for this forum allows you to add a class)
is working on a reply...
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.