Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify CSS properties for the IE only in the CSS file


Actually I need to specify this property

margin-left:-20px;

only for the IE-11 and the rest of the properties for all browsers in CSS file

.navigator li a span {
    display: block;
    float: right;
    width: 80px;
    height: 50px;
    margin-right: -10px;
    margin-left:-20px;
    }

Is there a way to do that, as I tried many solutions and didn't work
Thanks in advance!

like image 422
Yasmin Avatar asked Jan 21 '26 08:01

Yasmin


1 Answers

I wrote is very simple and only supported by IE 11+

<style type="text/css">
  _:-ms-fullscreen, :root .msie11 { color: blue; }
</style>

// or you can try this

<style>
  @media all and (-ms-high-contrast:none)
    {         
      *::-ms-backdrop, .foo { color: red } /* IE11 */
    }
</style>

and of course the div...

<div class="msie11">
    This is an Internet Explorer 11 and greater CSS Hack
<div>

So the text shows up in blue with internet explorer 11 and greater. Have fun with it.

for more reference you can look around with given link

Reference

like image 183
Himesh Aadeshara Avatar answered Jan 27 '26 02:01

Himesh Aadeshara