Bert
Thats exactly what I said:
"While the size reduction is not a huge benefit in the scheme of things, it does mean that I can change certain values that are common to many page elements like font-weight : bold; to another value eg: font-weight : bolder; in one place and have the change made though all the grouped elements at once, rather than having to change it half a dozen times in different selectors throughout the stylesheet."
So the big benefit is gained from using CSS in the first place, by seperating presentation from the HTML content, and a further benefit is gained by writing the CSS efficiently as Andy King says in 'Speed Up Your Website' - "specificity is the enemy of clean, fast code ... the more general you can be in rules and selectors, the fewer you'll need, and the smaller your files will be"
-- Neerav Bhatt http://www.bhatt.id.au Web Development & IT consultancy Mobile: +61 (0)403 8000 27
http://www.bhatt.id.au/blog/ - Ramblings Thoughts http://www.bookcrossing.com/mybookshelf/neerav
*****************************************************Neerav wrote: Hopefully http://www.bhatt.id.au/blog/2004/08/04/css-optimisation/ is helpful for anyone new to CSS, and still learning how to write it concisely and efficiently.
Bert wrote:
FWIW, while I agree with the general concept of using shorthand CSS (and I
use it too, wherever possible), a 797 byte saving in a CSS file is, in the
overall scheme of things, neither here nor there, even with a 28.8k modem
connection.
The worst kind of style sheets I see (apart from the ones that don't validate and those generated by Micro$oft Word etc) are those that break everything up. The ones that use 25 to 30 lines something like the css below.
#whatever { margin: 5px; padding: 10px; border: 2px solid red; font: bold 6pt/8pt Arial,Helvetica,sans-serif; background: red url(images/red.gif); }
How far can you stretch this? I swear I've seen it done on a live site...
Regards -- Bert Doorn, Web Developer www.bwdzine.com Fast-loading, user-friendly websites
The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
*****************************************************
