More CSS Optimization Techniques

A lot has been written about more efficient CSS (see below for some examples). Certainly, when you work with multiple people on larger sites, organizing your CSS in a logical, consistent manner becomes increasingly important.

In his post Squeaky Clean CSS Lokesh Dhakar provides some good tips and guidelines to follow.

Although the majority are not new to me, I did want to call out one useful technique I have not seen mentioned before for temporarily disabling style attributes.

Rather than commenting out the attribute, which can get pretty laborious after a while, simply place an “x” before the attribute name. For example:

#footer {
border-top: 1px solid #e5e5e5;
xborder-bottom: 1px solid #e5e5e5;

What a great idea! I can’t believe I’ve never thought of doing that myself.

Further Reading on CSS Organization Techniques

One thought to “More CSS Optimization Techniques”

  1. I done this for years, never really thought about it. I usually just as you say put an x in front of something or if its a value, I do it there, e.g.:
    color: x#fff;
    Nice one.

Comments are closed.