The following is an extract from our book, CSS Master, written by Tiffany Brown. Copies are sold in stores worldwide, or you can buy it in ebook form here.
Golden Guidelines for Writing Clean CSS
As mentioned, there are some rules for writing clean CSS that you should try your best to avoid breaking. They’ll help you write CSS that is lightweight and reusable:
- Avoid global and element selectors
- Omit overly specific selectors
- Use semantic class names
- Don’t tie CSS too closely to markup structure
Let’s look at these one by one.
Avoid Global Selectors
Global selectors include the universal selector (
... read the whole story at www.sitepoint.com.