Quick CSS Optimization Tip

comments suggest edit

When you see the following in your CSS

  margin-top: 10px;
  margin-right: 20px;
  margin-bottom: 10px;
  margin-left: 20px;

It makes sense to convert it to this.

  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!

Found a typo or error? Suggest an edit! If accepted, your contribution is listed automatically here.