Using IE conditional comments inside a stylesheet

后端 未结 6 1787
深忆病人
深忆病人 2021-02-01 02:59

I know that you can use an IE conditional comment inside HTML:


6条回答
  •  不要未来只要你来
    2021-02-01 03:17

    Conditional comments do not work within stylesheets. Instead, you can use conditional comments in your HTML to apply different CSS classes or IDs to elements that you can then target with CSS.

    For instance:

    
    
    

    Also, there are tools such as Modernizr that do feature detection in a very similar way (by adding classes to the element). You can use it to progressively enhance your design/script for newer browsers while still supporting older browsers.

提交回复
热议问题