Copied to clipboard

Flag this post as spam?

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


  • Craig O'Mahony 364 posts 918 karma points
    Apr 28, 2015 @ 10:05
    Craig O'Mahony
    0

    Adding formats to anchor tags

    Hi all,

    I'm trying to add a class to hyperlinks in the RTE. What I want to end up with is

    <a href="http://www.mysite.com" class="blue">Link</a>

    So I've associated a stylesheet to the RTE, created the link in there and then when I highlight the link and select the style from the format dropdown I actually end up with 

    <span class="blue"><a href="http://www.mysite.com" title="Home">Link</a></span>

    So the RTE is injected a <span> and adding a class to that and not to the anchor.

    Does anyone know how to stop this behaviour?

    Thanks,

    Craig

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Apr 28, 2015 @ 10:13
    Jan Skovgaard
    100

    Hi Craig

    It's a bit fragile and sometimes the class will be added to the anchor and sometimes it will be in span that's wrapping around the element. It's hard to fix I think.

    However I tend to simply work around it using my css stating this

    .blue,
    .blue a{
    color: blue;
    }
    

    Not always ideal, but it works and is far less time consuming that trying to fix the RTE behavior :)

    Hope this helps.

    /Jan

  • Craig O'Mahony 364 posts 918 karma points
    Apr 28, 2015 @ 10:27
    Craig O'Mahony
    0

    Hi Jan,

    That works!

    Cool cheers matey.

Please Sign in or register to post replies

Write your reply to:

Draft