How to change colors in text using css?

N

not_bad

Let's say I need somethink like that below.


Especially with h3 or bold. How can I change colors?

Sometimes I need just one letter in different color!

Google doesn't help a lot.

Help!


TIA


<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>

<h3>Lorem<font color="#00FF00"> </font><font
color="#FF00FF">ipsum</font><font color="#00FF00">
</font>dolor <font color="#FF0000">sit</font>
amet, <font color="#0000FF">consectetur </font>adipisicing elit, </h3>

</body>

</html>
 
A

Adrienne Boswell

Gazing into my crystal ball I observed not_bad <[email protected]>
writing in 01.iinet.net.au:
Let's say I need somethink like that below.


Especially with h3 or bold. How can I change colors?

Sometimes I need just one letter in different color!

Google doesn't help a lot.

Help!


<style type="text/css">
body {background-color: #fff; color:#000;}
..serengeti {
color: #B58E73;
}
..saintmartinsand {
color: #D6B6A5;
}
..middleburybrown {
color: #6B594A;
}
..monticellorose {
color: #CEAE9C;
}
..westonflax {
color: #F7E3B5;
}
</style>
</head>
<body>
<h3>Color Nonsense</h3>
<p><span class="serengeti">Serengeti</span> is not the same color as
<span class="saintmartinsand">St. Martin Sand</span> and is not the same
color as <span class="middleburybrown">Middlebury Brown</span>, and not
<span class="monicellorose">Monticello Rose</span> and certainly not
<span class="westonflax">Weston Flax</span>. Got it?</p>
 
J

Jukka K. Korpela

Scripsit not_bad:
Wow! Span is the trick!?

No, and span isn't CSS at all. The color property is the "trick".
Surprising, is it not?

Use of span is a usual sign of lack of understanding of markup issues,
though if giving abstract advice to a generic question, formulated in
foobarish (aka Lorem ipsum), there's little else one can use, since any
other inline element could be semantically _wrong_. The span element is
_meaningless_, i.e. semantically empty.

However, you could just as well use <font
class="serengeti">Serengeti</font>, being somewhat honest about it: you are
just thinking in terms of coloring words, not in terms of expressing
semantic or structural relationships.

If you want to save typing, <a class="serengeti">Serengeti</a> would be an
interesting option.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top