Make some letters one color while the rest of the text is another color

  • Hi guys!

    I was wondering whether there's some trick to highlight some word inside the text (say, make some word in the middle of the text red color) and keep the rest of it another color. As far as I can see from documentation, there's no way to achieve it except making a link. But it's clickable...

  • Hi,

    I would recommend using <span> and inline styles ,

    e.g. if you don't need Flash support you could do:

    Code
    html="black [span style='color:#0000FF;']blue[/span] black [span style='color:#FF0000;']red[/span] black"

    Adding Flash support would be possible too, but the Flashplayer would need a <font> element for changing the color (see here) - so <font> tags and color and style would need to be used together, a HTML5 browser will ignore the <font> and handle it like a <span> element.

    So that would be the same for Flash AND HTML5 support:

    Code
    html="black [font color='#0000FF' style='color:#0000FF;']blue[/font] black [font color='#FF0000' style='color:#FF0000;']red[/span] black"

    Best regards,
    Klaus

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!