1. Add a comment block at the beginning of the style sheet to describe the creation date, creator, tags and other remark information of the style sheet.
Example Source Code : /* ---------------------------------- Site: Site name Author: 52CSS.com Updated: Date and time Updated by: Name ---------------------------------- */ |
2. Include public color markings
Example Source Code : /* ---------------------------------- COLORS Body background: #def455 Container background: #fff Main Text: #333 Links: #00600f Visited links: #098761 Hover links: #aaf433 H1, H2, H3: #960 H4, H5, H6: #000 ---------------------------------- */ |
3. Give meaningful names to ID and Class
Not recommended naming method:
Example Source Code : .green-box { ... } #big-text { ... } |
Recommended naming method:
Example Source Code : .pullquote {... } #introduction {... } |
4. Integrate associated style rules
Example Source Code : #header { ... } #header h1 { ... } #header h1 img { ... } #header form { ... } #header a#skip { ... } #navigation { ... } #navigation ul { ... } #navigation ulli { ... } #navigation ul li a { ... } #navigation ul li a:hover { ... } #content { ... } #content h2 { ... } #content p { ... } #contentul { ... } #contentulli { ... } |
5. Add clear comments to styles
Example Source Code : /* ---------------------------------- header styles ---------------------------------- */ #header { ... } #header h1 { ... } #header h1 img { ... } #header form { ... } /* ---------------------------------- navigation styles ---------------------------------- */ #navigation { ... } |