[thelist] CSS Question - Simple

Stephen Caudill SCaudill at municode.com
Mon Sep 15 13:49:54 CDT 2003


Rob Smith on Monday, September 15, 2003 2:12 PM said:

: Hi list,
: 
: Is saying:
: 
: body {
: 	font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
: 	font-size: 12px;
: }
: 
: td {
: 	font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
: 	font-size: 12px;
: }
: 
: th {
: 	font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
: 	font-size: 12px;
: }
: 
: the same as...
: 
: body th td {
: 	font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
: 	font-size: 12px;
: }
: 
: Thanks,
: 
: Rob.Smith

Nope.  The first set of selectors applies these styles to body, td and
th.  The second applies those styles only to a td contained in a th 
(which would never happen) which is contained by a body element.  I 
think what you may have been looking for is:

bodt, th, td {
	font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
	font-size: 12px;
}


<tip type="Discerning CSS selector meanings" author="Stephen Caudill">
If you're new to CSS and are having trouble with level 2 selectors,
check out the SelectOracle at:
http://gallery.theopalgroup.com/selectoracle/
It's a great tool for understanding complex selectors... and nothing 
beats a good reading of the spec:
http://www.w3.org/TR/CSS2/selector.html
</tip>

hth,
Stephen Caudill
http://www.mechavox.com/


More information about the thelist mailing list