Page is a not externally linkable
- Code, Content, and Presentation
-- CSS
---- CSS Crib Sheet, cheatsheets, shortcut lists, syntax lists, & others


Hester - 10:01 am on Sep 21, 2004 (gmt 0)


Wrapdida:
heres an example of once vs many

<div id="contains all spec for this block">
<h1></h1>
<p></P>
<ul><li></li></ul>
</div>

vs

<h1 class="ye1"><h1>
<p class="yes2"></p>
<p class="yes3"></p>
<li class="yes3"></li>
<li class="yes4"></li>

What you could do with the second example is use styles based on the ID, like this:

#id h1 {color:green;}
#id p {color:red;}
#id p+p {color:blue;}
#id li {color:purple;}

So you can style each tag within the section based on the order of the tags. I cannot stress the usefulness of this enough - it saves using classes and spans.

Of course if you have two identical sections, by all means use a class. Eg:

<div class="example">
<h1></h1>
<p></P>
<ul><li></li></ul>
</div>

.example h1 {color:green;}
.example p {color:red;}
.example p+p {color:blue;}
.example li {color:purple;}


Thread source:: http://www.webmasterworld.com/css/4514.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com