Tuesday, April 5, 2011

Conditional stylesheets vs CSS hacks? Answer: Neither! « Paul Irish

Conditional stylesheets vs CSS hacks? Answer: Neither! « Paul Irish

Brilliant! Here is an excerpt from this great article:

"Here's my proposed solution:

          <body> 

Using the same conditional comments, we're just conditionally adding an extra class onto the body tag. This allows us to keep our browser-specific css in the same file:

 div.foo { color: inherit;} .ie6 div.foo { color: #ff8000; }

Plus it totally validates and works in all browsers.

(Hat tip to Paul Hammond and Adam McIntyre for being s-m-r-t.)"

No comments:

Post a Comment