css hack

css文件只加载到IE浏览器

<!-- [if IE] >

<link ref="stylesheet" type="text/css" href="test.css" />

<! [endif] -->

hack关键字:

lte:小于等于、lt:小于、gte:大于等于、gt:大于、!:不等于

css文件只加载到大于IE6的浏览器

<!-- [if gt IE 6] >

<link ref="stylesheet" type="text/css" href="test.css" />

<![endif] -->

css样式只加载到不是IE6的浏览器

<!-- [if ! IE 6] >

<style type="text/css">

.a{****}

</style>

<![endif] -->

javascript代码只加载到小于IE8的浏览器

<!-- [if lt IE8]>

<script type="text/javascript">

alert(111);

</script>

<![endif] -->

 

针对浏览器的hack前缀

.test{width:60px;/*所有浏览器*/ _width:60px;/*IE6浏览器*/ *width:60px;/*IE7浏览器*/}

*html .test{}/*IE6浏览器*/

*+html .test{}/*IE7浏览器*/

posted on 2015-04-10 11:28  ☆ゞ杰ゞ★  阅读(115)  评论(0编辑  收藏  举报

导航