Feeds:
Posts
Comments

Posts Tagged ‘CSS’

W3C Validation’ Category

The following CSS selectors are considered workarounds and hacks for specific web browsers.
IE 6 and below
* html {}
IE 7 and below
*:first-child+html {} * html {}
IE 7 only
*:first-child+html {}
IE 7 and modern browsers only
html>body {}
Modern browsers only (not IE 7)
html>/**/body {}
Recent Opera versions 9 and below
html:first-child {}
How to Apply Hacks
If you want to add 10px; padding to a div element called #rightpanel specifically for IE 7, then you can use the following hack:
*:first-child+html #rightpanel {
padding: 10px;
}

want to apply the padding just for IE 6, then its as following way:
* html #rightpanel {
padding: 10px;
}

Read Full Post »

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

Read Full Post »