IE8 css selector

后端 未结 14 1906
臣服心动
臣服心动 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 23:06

    2013 update: IE10+ no longer supports conditional comments.

    Original answer:

    Some people seem to be confused because this does not answer the letter of the question, only the spirit - so for clarification:

    There is no such thing as a browser selector. There are hacks that take advantage of bugs and/or glitches in specific browsers' CSS parsers, but relying on these are setting yourself up for failure. There is a standard, accepted way to deal with this:

    Use conditional comments to target IE only.

    Example:

    
    

    Everything inside the two will be ignored by all non-IE browsers as a comment, and IE versions that are less than IE8 will skip it. Only IE8 and greater will process it. 2013 update: IE10+ will also ignore it as a comment.

提交回复
热议问题