I've decided to use a very tiny bit of javascript to free me of css hacks. I already use js to add a class "jsEnabled" to the <html> element so that I can style things differently if I know that javascript is going to swoop in and alter them later (tabs, carousels, etc). Taking this a step further, I put the browser name + version number in the html element classname. Then in the css, you can write ".ie7 .my-div {float:none;}" Sure, we're not supposed to rely on javascript. But we usually do. And this is just for minor tweaks anyway. The site will still *work* with js turned off, you'd just lose that tiny css tweak you made that relies on it.
Showing posts with label ie7. Show all posts
Showing posts with label ie7. Show all posts
Saturday, May 2, 2009
How to Avoid CSS Hacks
Labels:
avoid css hack,
cross-browser,
css,
css hack,
firefox,
ie6,
ie7,
javascript,
js,
safari
Subscribe to:
Posts (Atom)