Quick CSS Optimization Tip

archived comments edit

When you see the following in your CSS

div
{
  margin-top: 10px;
  margin-right: 20px;
  margin-bottom: 10px;
  margin-left: 20px;
}

It makes sense to convert it to this.

div
{
  margin: 10px 20px;
}

It’s cleaner and takes up less space.

There are a lot of ways you can optimize your CSS in this way. I'm not talking about compression, but optimization.

Today, The Daily Blog Tips site linked to a website called CleanCSS that can perform many of these optimizations for you. For example, feed it the above CSS and it will make that conversion. Very nice!

Comments