Web Design: Optimizing Your CSS

Cascading Style Sheets have been a crucial part of web design for awhile now, as they improve your websites performance by allowing caching of your websites style information, avoiding the need for a hard refresh every time a page is loaded. 

I’ve spent the last few days cleaning up the code on this site, removing the center commands (for example) and moving them over to my Stylesheet, giving it a cleaner look and allowing me to make bulk changes easier going forward.   I’ve also been using a CSS optimizer tool called CleanCSS which I found via Daily Blog Tips.   For example, it would compress unneeded extra code and convert it to more managable code.   For example, instead of using:

margin-top: 5px;
margin-right: 6px;
margin-bottom: 7px;
margin-left: 8px;

you should instead use:

margin: 5px 6px 7px 8px;

I was happy to see my code didn’t need to much help (which means I’m doing things the right way I guess), but it was very useful. 

Want automatic updates? Subscribe to our RSS feed or Get E-mailed Updates! |

Post a Response