Previous Message
Next Message

Cascading Style Sheets: The Definitive Guide & Span & Div

Sent by Kevin H. Stecyk on 28 May 2004 04:04


Zoe M. Gillenwater wrote...

> I'm not really clear on what you're asking here.  What do you 
> mean by "start a new tag?"
> 
> There are a number of different ways to apply styles to a 
> document, and which one is the "best" depends entirely on the 
> specific situation.  For instance, you can apply style to:
> 
> 1. The natural, semantic container of the content 2. A class 
> applied to that natural container 3. An "artificial" 
> container (div or span) of the content with its own class or id etc.
> 
> There are other options as well, and you should make your 
> choice among all of these by asking:
> 
> A. Which is the cleanest, most semantic code?
> B. Which is the best for the most number of my users?
> C. Which is the most flexible to any future changes I may 
> need to make?
> etc.
> 
> Back to the emphasizing example.  Here you should hands-down 
> use the <em> tag (option number 1 above).  If this piece of 
> emphasized text is or will be different from the other pieces 
> of emphasized text on the site, still use the <em> tag, but 
> give it a class (option number 2 above).  Or, rely on parent 
> elements to avoid classes (if emphasized text in your sidebar 
> needs to look different, just use the rule "#sidebar em 
> {...}").  There is no reason to use option number 3 (wrapping 
> it in a div or span).  The only time when you would use a div 
> or span would be when there is no natural container for the 
> piece of content you want to style.
> 
> Basically, try to use as few divs and spans as possible, and 
> don't try to give everything a class either.  Take advantage 
> of natural elements and inheritance as much as possible when 
> styling elements.  This keeps your code much more simple, 
> which is good for both your user and yourself.
> 
> I don't know if this answered your question though. :-)
> 

You've done an excellent job Zoe in answering my question.  Again, I am new
to both HTML and CSS, so I've got a lot of the terminology floating around
in my brain.  Your comments are very helpful in putting everything in its
proper bucket.

A sincere thank-you!

Best regards,
Kevin


null
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: