[thelist] Nesting CSS Classes...Why??

Bob Boisvert webdad at tampabay.rr.com
Sat Mar 2 22:43:01 CST 2002


OK, I was just reading Essential CSS & DHTM For Web Professionals and
something caught my eye  and confused me a little. Page 11, 12 if your
interested.  I hope this makes sense, although I have written some CSS
before, I learned it on my own from studying others and am now starting to
read about it from the books.

What is the need of a second class if it inherits the attributes of the
first?.  Both classes have a font-weight but only the weight of the first is
used disregarding the second (the way it reads in the book, seems like a
typo). Is nesting CSS classes a common practice? and what's a good example
of why a designer would use this?.  Is it pointless to nest the classes if
one inherits the others attributes, seems like it's better if some text
needs to changed after a class is called to use <font face="Arial, Verdana,
Tahoma" font size="20px">More Text!!</font>.

So far I enjoy writing the CSS and looking at it's outcome, and it's much
easier to change a lot of info at once rather than bits and pieces here and
there all over the document. But the information in the classes seems to
become a little redundant when nesting them.

Class1 is specifying:

font-family
font-weight
color
font-size
font-style

Class2 is specifying:

font-weight
color

so,
<span class="Class1">Some Text Here..<span class="Class2> More Text
again...</span></span>


Bob

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.324 / Virus Database: 181 - Release Date: 2/14/02





More information about the thelist mailing list