条件注释
867 次查看以前一直是把支持IE的CSS跟JS都与项目中的基本代码写在一起的,现在想想这确实不是个好方法,不但调试起来很不爽,而且维护起来也很麻烦。一直忘了条件注释这么个好东西,可以把支持IE的hack code单独写在一个文件里,用条件注释的方式引入。
示例如下:
<!--[if IE]> Internet Explorer <![endif]--> <!--[if IE 5]> Internet Explorer 5 <![endif]--> <!--[if IE 5.0]> Internet Explorer 5.0 <![endif]--> <!--[if IE 5.5]> Internet Explorer 5.5 <![endif]--> <!--[if IE 6]> Internet Explorer 6 <![endif]--> <!--[if IE 7]> Internet Explorer 7 <![endif]--> <!--[if gte IE 5]> Internet Explorer 5 and up <![endif]--> <!--[if lt IE 6]> Internet Explorer lower than 6 <![endif]--> <!--[if lte IE 5.5]> Internet Explorer lower or equal to 5.5 <![endif]--> <!--[if gt IE 6]> Internet Explorer greater than 6 <![endif]-->


最新评论