user2135651 user2135651 - 1 year ago 321
CSS Question

How to write a CSS hack for IE 11?

How can I hack or write css only for IE 11? I have a website that looks bad in IE 11.I just search here and there but didnt find any solution yet.

Is there any css selector?

Answer Source

Use a combination of Microsoft specific CSS rules to filter IE11:

<!doctype html>
  <title>IE10/11 Media Query Test</title>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
    @media all and (-ms-high-contrast:none)
     .foo { color: green } /* IE10 */
     *::-ms-backdrop, .foo { color: red } /* IE11 */
  <div class="foo">Hi There!!!</div>

Filters such as this work because of the following:

When a user agent cannot parse the selector (i.e., it is not valid CSS 2.1), it must ignore the selector and the following declaration block (if any) as well.


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download