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

CorsairDev at aol.com CorsairDev at aol.com
Sun Mar 3 02:13:01 CST 2002


--
[ Picked text/plain from multipart/alternative ]
In regards to nesting of CSS Classes....

Obviously nesting of CSS Classes is pointless IF both classes have exactly
the same attributes.  It's just as redundant as a all those FONT tags that
the WYSIWYG editors out there (<cough>Frontpage</cough> ;-) ) put in the
source code.  But, at any rate, the main reason why you would have classes
that are nested is if you have something that needs to have a tweak from the
first Class.

For instance your example of:
<span class="Class1">Some Text Here..<span class="Class2> More Text again...<
/span></span>

Perhaps they all are Verdana, 400, #FF0000, 10pt, Normal (according to your
specifications for Class1).  Then Class2 changes it to 800, and #CC0000.
Just a slight change but it still needed the main components of Class1.  You
could however change the HTML to look like this:
<span class="Class1">Some Text Here..</span><span class="Class2> More Text
again...</span>

Would work the same, if you put all the attributes in Class2.  But perhaps
you wanted to make it like this:
<span class="Class1">Some Text Here..<span class="Class2> More Text again...<
/span>And even more text is here...</span>

This would change the "Class2" section slightly while going back to "Class1"
for the third section of text.  So it all depends what you are trying to do.

With all the stuff I've done with CSS, nesting Styles is something I've
hardly ever used but it all depends on how you want to accomplish the task.

Steven
CorsairDev.com



More information about the thelist mailing list