Basic CSS Optimisation Principles

As an exercise in keeping my skills sharp I decided to see how far I could optimise this website’s CSS (cascading style sheet), and set out a basic set of principles to follow when writing CSS to keep the code concise and with as little repitition of values as possible.

After a mere 15 minutes I reduced the old style sheet from 4,267 bytes to 3,470 bytes in the new style sheet, a 19% reduction. 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.

Bearing in mind that the CSS had already been optimised to some extent when first coded … these are some of basic principles I applied: Continue reading Basic CSS Optimisation Principles