5. Use multiple declarations
where possible
p
{
! margin: 0 0 1.5em;
! background: green;
}
6. Use multiple selectors
where possible
h1, h2, h3, h4, h5
{
! color: #666;
! margin: 0 0 .5em;
}
7. Use shorthand properties
where possible
body
{ Avoid
margin-top: 20px;
margin-right: 10px;
margin-bottom: 20px;
margin-left: 10px;
} Preferred
body { margin: 20px 10px; }
8. Avoid !important as it is often
unnecessary - especially when
you understand the cascade.
p Avoid
{
! margin: 0 !important;
}
9. Avoid complex selectors
(taxing for browsers). Try to be
only as specific as needed.
Avoid
#navigation ul li a { margin: 0; }
#navigation a { margin: 0; }
Preferred
18. If possible, use CSS3 rules
instead of images to reduce
server requests and page size.
Avoid
p { background: url(round-corners.png); }
p { border-radius: 10px; }
Preferred