tags:

views:

353

answers:

1

Which css hacks we use to make layout cross browser compatible

  • Can pass W3C validation
  • Will work forever
  • Will never create in any future browser versions

What are alternatives which can pass the w3c validation for popular CSS hack which are not valid?

for example

underscore hack, zoom:1 etc.

my purpose is to make a list of W3C validated and non problematic CSS hacks and techniques which can be helpful to make CSS layouts cross browser compatible.

mainly we use CSS hacks for IE , but sometime we need Hacks for other desktop browsers also.

Main Concerned browsers are:

  • IE6, IE7, IE8
  • Safari latest final release
  • Firefox 3.6, 3.5 , 3.0 and 2.0
  • Opera Latest final release
  • Google Chrome latest
+2  A: 

Here is the list:

  1. Easy selectors
  2. Minimized attribute selectors
  3. !important
  4. @import "non-ie.css" all;
  5. body[class|="page-body"]

They are listed here: In-CSS Hacks.

However, nobody promise they will work forever.

The best approch for IE hacks is to use conditional comments.

Sagi
_property: value, body:empty are not W3C valid
metal-gear-solid
@Jitendra Of course they are'nt. Look only at "In-CSS Hacks". You look at "Unrecommended hacks".
Sagi
"However, nobody promise they will work forever." Why you mean if future Microsoft can release patch for IE6 and 7
metal-gear-solid
@Sagi - yes you are right +1 for good link
metal-gear-solid
@Jitendra IE6 is not supported anymore. And I don't think it will happen for IE7 neither. but I'm talking about future versions, like IE9. You can't know in advance how it will handle them. So the safest approach is to use conditional comments.
Sagi
you are right + 1 to ur good comment
metal-gear-solid