views:

84

answers:

2

What is harmful in to use css hacks instead of IE conditional stylesheets. What is bad with css hack , will i get any problem in css management now or in future with hacks. I read many articles but haven't found any good reason.

adding extra external conditional stylesheet means one more HTTP request.

+6  A: 

Relying on a CSS hack means two things could possibly happen:

  1. A patch or update could fix the hack you're relying on, breaking your site until you find out about it
  2. Future browsers could also have buggy reactions to the hack, making your stylesheets unstable - you would need to remove the hack to fix for the newer browser and find a new workaround for the old one. Again, your site would be broken until you find out about the problem.

Either way, the safest thing to do is use standards-compliant stylesheets and conditional comments. By definition, support for these will only get better with time, so you are essentially future-proofing your site.

If you're especially concerned about the overhead of an extra stylesheet for certain browsers, consider putting them inline. Your overrides should typically be minimal - 90+% of styles should be shared across all platforms.

Rex M
+1  A: 

Biggest reason: Hacks usually rely on some implementation flaw - but if MS fixes the flaw, your hack won't work (or at least not the way you intended.)

If you use proper conditional comments, it will weather the updates fairly predictably.

This is why there was such a furor over IE7 and IE8 - both fixed a lot of bugs and jacked up a lot of sites that relied on IE6 bugs.

AnonJr
Apparently, you're damned if you *do* fix the bugs, and damned if you *don't*
pavium
No. You will be damned if you take so long to fix bugs that millions of people come to depend on them not being fixed. You are more likely to be forgiven if you fix the bugs relatively quickly.
Stephen C
And *you* are damned if you deliberately rely on bugs when there are known, legitimate workarounds.
Rex M