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