IE8 css selector

后端 未结 14 1933
臣服心动
臣服心动 2020-11-30 22:44

To target elements only in IE browsers i\'ll use

IE6:

* html #nav li ul {
    left: -39px !important;
    border: 1px solid red;
}

14条回答
  •  生来不讨喜
    2020-11-30 22:56

    I'm not going to get in a debate about whether or not this method should be used, but this will let you set specific css attributes for IE8-9 only (note: it is not a selector, so a bit different than what you asked):

    Use '\0/' after each css declaration, so:

    #nav li ul  {
      left: -39px\0/ !important;
    }
    

    And to build off another answer, you can do this to assign variou styles to IE6, IE7, and IE8:

    #nav li ul  {
       *left: -7px    !important; /* IE 7 (IE6 also uses this, so put it first) */
       _left: -6px    !important; /* IE 6 */
        left: -8px\0/ !important; /* IE 8-9 */
    }
    

    source: http://dimox.net/personal-css-hacks-for-ie6-ie7-ie8/

提交回复
热议问题