HighDots Forums  

List. How can I do this?

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss List. How can I do this? in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
shapper
 
Posts: n/a

Default List. How can I do this? - 10-24-2007 , 08:55 AM






Hello,

I have a list as follows:

<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?

Thank You,
Miguel


Reply With Quote
  #2  
Old   
Jonathan N. Little
 
Posts: n/a

Default Re: List. How can I do this? - 10-24-2007 , 09:02 AM






shapper wrote:
Quote:
Hello,

I have a list as follows:

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?
In stylesheet

..special { color: red; }

In HTML:

<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>

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com


Reply With Quote
  #3  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: List. How can I do this? - 10-24-2007 , 09:14 AM



Scripsit shapper:

Quote:
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/



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.