How can I set CSS only for specific IE browsers?

后端 未结 7 2323
庸人自扰
庸人自扰 2020-12-13 22:24

I have a CSS/jQuery Checkbox style script: http://jsfiddle.net/BwaCD/

The problem is, in current browsers in order for the span to float over the input, the input\'s

7条回答
  •  甜味超标
    2020-12-13 22:54

    EDIT (Aug. 28): Note that the following answer is relevant, in practice, only for Internet Explorer, at least versions 8 and earlier. To my knowledge, no mainstream browser now supports conditional comments, not even Internet Explorer 11.


    You can use Internet Explorer's conditional comments to add a class name to the HTML root tag for older IE browsers:

    
    
    
      
    

    Then you can define IE-specific CSS by referencing the appropriate class name, like this:

    .ie8 body {
       /* Will apply only to IE8 */
    }
    

    Source: http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/

提交回复
热议问题