Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apply only to IE 11 within media query for screen size

I currently have following width specific media query.

 @media only screen and (max-width: 1920px) {
    .toggleMultiSelect .filter {
        width: 566px;
    }
 }

But the width for '.toggleMultiSelect .filter' changes in IE from Chrome/Firefox. So basically need to apply different width for the same css class in 1920px for IE. From the Stackoverflow search I found that IE specific behavior can be achieved like below.

@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
    .toggleMultiSelect .filter {
        width: 575px;
    }
}

So now I need to achieve both resolution and css class. 575px width only should apply to IE and Chrome or firefox should get 566px.

Thanks in advance for any help.

like image 438
Luke Avatar asked Aug 31 '17 05:08

Luke


People also ask

How do you set the minimum width and maximum width in media query?

If you want to include both min and max width for responsiveness in the browser, then you can use the following: @media (min-width: 768px) and (max-width: 992px){...} @media (min-width: 480px) and (max-width: 767px) {...}

How do you change the width of a media query?

Setting a particular "width-range" isn't any different from the way media queries are created. The only difference is the addition of more media feature expressions (that is, the screen width sizes). Take a look: @media only screen and (min-width: 360px) and (max-width: 768px) { // do something in this width range. }

What does the below media rule specify @media screen?

The @media rule is used in media queries to apply different styles for different media types/devices. Media queries can be used to check many things, such as: width and height of the viewport. width and height of the device.

Do media queries work in IE?

Media Queries SupportCSS Media queries are supported in Internet Explorer (IE) 9+, Firefox 3.5+, Safari 3+, Opera 7+, as well as on smartphones and other screen-based devices. Although older versions of IE don't support media queries, still there is a way you can make it work.


1 Answers

Use the below css inside the media query

IE 10 and above

_:-ms-lang(x), .ie10up { 
       property:value; 
    }

IE 11 and above

_:-ms-fullscreen, :root .CLASS_NAME { 
       property:value; 
     }
like image 185
Shahil M Avatar answered Sep 28 '22 01:09

Shahil M