Skip navigation

Few CSS tips

  1. @import delay page load. use <link> instead
  2. Don’t include unit for zeros.
  3. Avoid padding/border and fixed width.
  4. Use IDs for structural elements. let .net use ID’s happily!!
  5. Name ID/classes based on its function never for its appearance.
  6. Dont use short names; use full descriptive names
  7. HTML attributes “id” and “class” are case sensitive! so always use lower case for naming
  8. It is better to use reset browser stylesheet.
  9. Use relative font sizes
  10. Inline styles are only for testing.
  11. css style order:- a:link, a:visited, a:hover and a:active (LoVe HAte)
  12. Don’t use <br />; instead use <p> with margin & padding.
  13. Use tags appropriately like <blockquote>, <cite>, <h1>…<h6>, <strong>, <em>, etc
  14. Don’t use html comments inside external css because it lead to  misinterpretation (child selector >)

Your thoughts??

2 Comments

  1. 1. TRUE
    2. ZERO has the same value with any unit 😉
    3. Wrong statement
    4. Makes sense
    5. Partially correct
    6. Depends on the developer’s naming conventions
    7. Depends on the developer’s naming conventions
    8. Saves a lot of time 🙂
    9. Depends on design
    10. There is no such rule (can be self-imposed)
    11. LoVe HAte
    12. Use where a line break is necessary, do not use for adding spacing between elements.
    13. Makes the markup meaningful
    14. Why would you do that, HTML comments should and supposed to appear within HTML documents and not in stylesheets.

  2. @import is about graceful degradation, not performance.


Leave a comment