Quick Tip 5 – Compact CSS

Are you finding that sometimes you are writing out the same rules multiple times for classes, id’s or tags?

A very simple tip today, but one that can help dramatically reduce the amount of CSS Styles you create.

This, For Example:


.col_1 { width: 330px; height: 400px; padding: 20px; background: #ccc; }
.col_2 { width: 330px; height: 400px; padding: 20px; background: #666; }
.col_3 { width: 330px; height: 400px; padding: 20px; background: #999; }

Quick Tip Gary
Should Be:


.col_1, .col_2, .col_3 { width: 330px; height: 400px; padding: 20px; }
.col 1 { background: #ccc; }
.col 2 { background: #666; }
.col 3 { background: #999; }

Therefore you no longer have to repeat any code that has already been assigned.

Related posts:

  1. Quick Tip 6 – CSS Shorthand
  2. Quick Tip 7 – CSS !Important
  3. Quick Tip 9 – CSS min height
  4. Quick Tip 2 – CSS Text Shadow
  5. Quick Tip 10 – CSS Vertical Alignment

Tags: , ,

Leave a Reply

Gary Morgan

Gary Morgan
Sales Director

Martyn Palmer

Martyn Palmer
Lead Designer

Oliver Blake

Oliver Blake
Web Designer

Tom Bradshaw

Adam Church
Web/Print Designer

Website Design

Website Design

For the complete standard compliant website.

Online Shops

Online Shops

Sell Products Online and manage your own stock.

Seo Marketing

SEO Marketing

Rank with search engine optimisation.

Print Design

Print Design

Logo design, stationary design & folder design.