Is there any way to make a CSS code for a specific browser?

Asked

Viewed 35 times

0

Next, I’m putting together a page that at a certain location I use a max-height, property that does not work on IE11.

img {
    max-height: 45px;
}

To solve this in the IE specifically I can change the max-height for height: 45px, but is it possible to do this just for IE? because he needed this max-height in other browsers.

1 answer

2


In the case of IE versions 10 and 11, it is possible to use a media query:

@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
     /* IE10+ CSS styles go here */
}

Source: How to target only IE (any version) Within a stylesheet?

For other (modern) browsers, it is recommended not to test which browser, but whether it supports the property you intend to use, through the @supports.

  • Solved perfectly, thank you. (:

Browser other questions tagged

You are not signed in. Login or sign up in order to post.