0

Ie is being weird again.

Our team is trying to add some styles for ie only so resize some text that lays on an image. The first ms-high-contrast works however all the following media queries fail. Is there a better more eloquent way to do this?

We're at a loss. What's up with ie?

@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
    .homebox .mdlogolg{
        left: -60px;
    }
    @media (max-width: 1199px) and (min-width: 992px) {
        .homebox .mdlogolg{
            left: -60px;
        }
    }
    @media (max-width: 991px) and (min-width: 768px) {
        .homebox .mdlogolg{
            left: -36px;
        }
    }
    @media (max-width: 767px) {
        .homebox .mdlogolg{
            left: -25px;
        }
    }
}
zazvorniki
  • 3,512
  • 21
  • 74
  • 122

2 Answers2

2

You can achieve the above by separating those media queries (because, nesting won't work). Try the following code...

@media (max-width: 1199px) and (min-width: 992px) and (-ms-high-contrast: none), (max-width: 1199px) and (min-width: 992px) and (-ms-high-contrast: active) {
    .homebox .mdlogolg{
        left: -60px;
    }
}
@media (max-width: 991px) and (min-width: 768px) and (-ms-high-contrast: none), (max-width: 991px) and (min-width: 768px) and (-ms-high-contrast: active) {
    .homebox .mdlogolg{
        left: -36px;
    }
}
@media (max-width: 767px) and (-ms-high-contrast: none), (max-width: 767px) and (-ms-high-contrast: active) {
    .homebox .mdlogolg{
        left: -25px;
    }
}
ARUN
  • 109
  • 13
0

Actually, there is no media queries for IE, but you can create separate stylesheet for IE with all properties and he will apply automatically, if it IE.

<head>
    <!--[if IE]>
        <link rel="stylesheet" type="text/css" href="all-ie-only.css" />
    <![endif]-->
</head>

This article might help you. Also, you can watch at code example of Bootstrap, what they invent for IE supporting.