CSS inheritance - newbie question

by "John Aitchison" <jaitchis(at)hwy.com.au>

 Date:  Wed, 3 Oct 2001 19:09:10 -0700
 To:  HWG Techniques <hwg-techniques(at)hwg.org>
  todo: View Thread, Original

Hi

I am fairly new to CSS and have been pondering over a matter of 
style . 

It seems to me fairly usual practice for people to define the style 
elements 'independently' like so 

H1 { font-family: arial, tahoma, helvetica, sans-serif;
font-style: normal;
font-size: 18pt;
font-weight: bold;
color: #003366;
text-align: center;
text-transform: None }

/* Article Title */
H2 { font-family: arial, tahoma, helvetica, sans-serif;
font-style: normal;
font-size: 20px;
font-weight: bold;
color: #003366;
text-align: center;
text-transform:None }

/* Section Headings */
H3 { font-family: arial, tahoma, helvetica, sans-serif;
font-style: normal;
font-size: 13pt;
font-weight: bold;
color: #336699;
text-align: left;
text-transform: None }


but my gut feel is that it would be better (? more maintainable) to 
define the style of a group of elements together and then to specify 
the exceptions eg

H1,H2,H3 { font-family: arial, tahoma, helvetica, sans-serif;
font-style: normal;
font-size: 18pt;
font-weight: bold;
color: #003366;
text-align: center;
text-transform: None }

/* Article Title */
H2 {
font-size: 20px;
 }

/* Section Headings */
H3 {
font-size: 13pt;
color: #336699;
text-align: left;
 }

Is there some reason for NOT doing it the way I suggest? ie defining 
a common base style and noting the exceptions?

OT
1. Does anyone know of a CSS 'tidy' program ? I would prefer to see

H3 {
font-size:        13pt;
font-weight:     bold;
color:             #336699;
text-align:        left;
 }

2. This CSS comes from a real site that has been mentioned on this 
list before. I still have not come up to speed on the arguments for px 
vs em vs pt, but I note that the above CSS uses a mixture of px and 
pt. Is this more likely an oversight or is it possibly a design 
consideration that I am unaware of?

Thanks

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA

This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.