views:

1392

answers:

3

Hi y'all...

What is the IE hack for setting the position property : relative in "not-a-browser"IE and position : absolute in other browsers (FireFox, Chrome)..

Thanks everyone..!!!

+2  A: 

I use conditional comments in the <head> to send different versions of IE different 'hack' stylesheets. That way I can keep my main css file clean. Make sure you include the IE stylesheets after your main stylesheets.

Skilldrick
can we use the conditional comments in a .css file?
SpikETidE
No, you have to give 2 seperate CSS files, one for all browsers, and for for IE hacks.
e-satis
+1  A: 

Hi Here is a Sheet about CSS hack for different browser:

            IE6  IE7  IE8  FireFox  Chrome
    _        Y    N    N      N       N
    *        Y    Y    N      N       N
!important   N    Y    Y      Y       Y
----------
    \9       Y    Y    Y      N       N

I think if you want a hack for IE/None-IE, you can set \9 at the end of your css attribute. Comment: Sorry, it's too hard to make a sheet in the editor.

e.g.

.test{

position:absolute;/* This is for all browser*/

position:relative\9;/* This will be only supported for IE6/7/8 and will overrider the up position attribute

}

Sorry, I'm not familliar with this editor, it's really hard to make the answer looks better.

jujusharp
What? Could you give a bit more information? An example maybe?
borisCallens
A: 

shortest way to do this:

.myStyle {
  position:absolute
  _position:relative
}

Although possibly not the cleanest...

Paul