denisjacquemin
denisjacquemin

Reputation: 7414

CSS hacks Raison d'être

Since I build layouts with CSS, I always refuse to use CSS hacks for different browsers.

In your opinion, is there real benefits to use hacks?

Cheers

Upvotes: 1

Views: 182

Answers (5)

Justin Johnson
Justin Johnson

Reputation: 31300

Typically, I would say that they're easy and just work. That said, there are typically other, more correct, ways of addressing whatever issue the developer may be facing.

I found this article about guidelines for using and creating CSS hacks.
The most apparent point is:

Avoid Targeting Current Versions Of Browsers

which, IMHO, is pretty sound advice. The author also provides intelligent criteria for what a CSS hack should conform to.

Here's an abridged version:

  1. Be valid. Invalid hacks are unacceptable.
  2. Target ONLY older/frozen/abandoned versions of user agents/browsers.
  3. Be ugly.

Upvotes: 2

K. Norbert
K. Norbert

Reputation: 10684

If it's a hack that does not have side-effects, or it has been around long enough for the side effects to be known, and it will save me time, I'll go for it without thinking for a second, I don't care if it's invalid.

Mostly IE6 stuff comes to mind, I'm pretty sure that I don't have to fear upgrades breaking the hacks there.

Upvotes: 0

Victor
Victor

Reputation: 9269

The benefit of a hack: To deliver

Upvotes: 5

Tor Valamo
Tor Valamo

Reputation: 33759

If by "real benefit" you mean, you'll be able to view your website with that particular effect in browsers that don't actually support it, then yes, it's worth it...

You can say "This car would look nicer in red than in blue, but red is more expensive and takes longer to dry, so i'll go with blue". You make a compromise. If you choose to drop a CSS effect because you'll need to use a hack to make it work in all browsers, then that's your choice. As long as you're comfortable with the compromise of better maintainability for less "zing!".

Upvotes: 0

Egor Pavlikhin
Egor Pavlikhin

Reputation: 17991

The only benefit I can see is saved initial time, so it's acceptable if you want to release something very very quickly. In which case anything is acceptable anyway. But maintaining even a single hack in CSS will be painful.

Upvotes: 0

Related Questions