Scripsit shapper:
<ul>
<li>word 1</li>
<li>word 2</li>
<li>word 3</li>
<li>word 4</li>
<li>word 5</li>
</ul>
I want all the list items to have the same font size but Word 1 and
Word 2 must also be red.
What is the best way to do this using CSS?
What's the problem? They have same font size by default. You can make the
first two items different from the rest by using classes:
<ul>
<li class="special">word 1</li>
<li class="special">word 2</li>
<li>word 3</li>
<li>word 4</li>
<li>word 5</li>
</ul>
and the CSS code
li.special { color: red; background: white; }
You can dispense with class attributes as follows, but it won't work on IE 6
and earlier:
ul li:first-child, ul li:first-child + li { color: red; background: white; }
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/