Quantcast
Channel: Web Usability » web2usability
Viewing all articles
Browse latest Browse all 10

Best Practices of CSS

$
0
0

1. Avoid CSS Expressions

2. Avoid Filters

3. Specify units for non-zero values, but not for zero values.

4. Don’t use quotation marks around paths/URLs when setting a background image or loading in an imported file

5. Try to avoid applying padding/borders and a fixed width to an element. Rather, apply padding to the parent element.

6. Minimize number of ID’s used

7. Minimize number of classes used

8. Don’t use anchors, instead use ID’s.

9. Combine selectors.

10. Use good naming conventions

11. Never use layout descriptives in class names.

12. Use functional names for your classes.

13. Always use intention revealing classnames

14. Avoid using the same classname for different purposes.

15. Always use the same classname for similar purposes.

16. Put your classname on the outer-most element. The child elements can be targeted with the parent elements classname or ID.

17. Declare relative font sizes instead of absolute.

18. Avoid !important.

19. Code link pseudo-classes in this order: Link, Visited, Hover, Active.

20. Minify CSS

21. Optimize CSS Sprites


Posted in CSS, Usability Tagged: Best Practices, CSS

Viewing all articles
Browse latest Browse all 10

Trending Articles