Help - Search - Members - Calendar
Full Version: Multiple colors of text on one line
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
Styler001
Maybe it's because I'm a huge noob at this, but I can't figure out how to go about displaying words with different colors on the same line. I can get them to list one after the other down the page, but not on the same line.

I know I could do something like <font color = "red">, but I also know that the <font> tag has been deprecated. I just don't know how to manage this using styles instead.

What I'd like is something like:

Red Blue Green Orange Purple Black

Instead of:

Red
Blue
Green
Orange
Purple
Black

I know this is probably like Noob 101, but I can't figure it out. If you could help me out (without laughing at me too much), I'd really appreciate it.
pandy
How do you get them one efter the other?

Yeah, FONT is uncool. This isn't much cooler, but to do what you want you need to wrap each word in an element.
CODE
<span class="red">Red</span> <span class="blue">Blue</span> <span class="green">Green</span>...

Then you use CSS to style those classes.
Styler001
I don't know if this is the proper way to do it, but it worked. I already had the <pre> tag defined for something else, so I used it again.

CODE
<pre><span style="color: blue">Blue</span>     <span style="color: red">Red</span>     <span style="color: purple">Purple</span>     <span style="color: orange">Orange</span>     <span style="color: green">Green</span>     <span style="color: black">Black</span></pre>


I guess I could have put the blank spaces in with the text, but either way, it works out OK.

Thanks for the quick response.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.