Avoid CSS Hacks

Contact Us or call 1-877-932-8228
Avoid CSS Hacks

Avoid CSS Hacks

If you look for solutions to problems you are having getting your pages to appear the same in different browsers, you're very likely to come upon many "CSS hacks". These are tricks that take advantage of browser bugs to get them to behave the way you want them to. One problem with using CSS hacks is that it is often unclear how the code will affect new browsers, future versions of existing browsers, or other devices that view web pages. Another problem is that these hacks can add a lot of complexity to your code, which runs counter to one of the main benefits of CSS - code simplification.

It doesn't take new CSS developers too long to discover that early versions of Internet Explorer are the most problematic of browsers. The most current versions of IE are some of the best at rendering to strict standards but versions 7 and below have some quirks. Microsoft introduced conditional comments with IE5 and they work great.. We recommend you use them instead of CSS hacks. In fact, you might want to have a special style sheet devoted to Internet Explorer's quirkiness and use a conditional comment to load it.

Next