css ie only code example

Example 1: css for internet explorer only

@media all and (-ms-high-contrast: none), 
               (-ms-high-contrast: active) {
  /* IE10+ CSS styles goes underneath */
  #ie11 h2 {
    color: #fff;
  }
  #ie11 h2:hover {
    color: gray;
  }
}

Example 2: styles only for IE

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

Example 3: css ie11 only

/* styles only for IE  */
    @media all and (-ms-high-contrast:none)
     {

     }

Tags:

Css Example