CSS: IE 9 hack for margin-left? \9; has no effect
23,008
Solution 1
Found it was
writing-mode:tb-rl;
IE didnt like.
This site was useful:
http://www.useragentman.com/IETransformsTranslator/
Solution 2
.class {
text-align:right;
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
margin-left: 30px
}
margin-left: 90px;
}
You can write the specific css for IE, then overwrite other css for other browser.
Solution 3
If you really need to, you can use an IE conditional block:
<link href="style.css" rel="stylesheet" />
<!--[if lt IE 10]>
<style type="text/css">
.thing {
margin-left: 10px;
}
</style>
<![endif]-->
Author by
MeltingDog
Updated on August 08, 2020Comments
-
MeltingDog over 3 years
I have an element that currently has
margin-left: -110px
of course, this works with my design in all browsers except IE. With IE I need to make itmargin-left: 10px
Normally, I would do my IE hacks by adding
\9;
, such as:margin-left: 10px\9;
but it doesnt seem to work with margins. Does anyone know a way to acheive this? Many thanks!
<div id="nav"> <ul> <li id="newstab">News</li> <li id="offerstab">Offers</li> <li id="specialsstab">Specials</li> </ul> </div> #nav { position:absolute; margin-left: -110px; margin-left: 10px\9; margin-top: 160px; writing-mode:tb-rl; -webkit-transform:rotate(90deg); -moz-transform:rotate(90deg); -o-transform: rotate(90deg); white-space:nowrap; }
-
MeltingDog about 11 yearshmm no luck! Its odd...If I go into IE's developer tools and find the element and alter the css it works. Its just ignoring the hacks on the style sheet
-
Wesley Murch about 11 years@MeltingDog From what you said it doesn't sound like you actually tried this answer (although admittedly, it's not a direct answer). Either that or you aren't sure what effect you're expecting to see.
-
MeltingDog about 11 years@WesleyMurch yes I did try the answer, and experimented with several similar versions. You are meant to place would have written on the header of the HTML doc, right?
-
Wesley Murch about 11 yearsThe
\9
hack already works though, and it's the topic of the question.