IE浏览器引用css样式表的方法

来源:互联网 发布:ubuntu如何卸载wine 编辑:程序博客网 时间:2024/06/07 07:33

IE浏览器引用css样式表的方法:

1.Hack的写法:

:root .demo {color: #ff09;}/* IE 9 的写法 */*:first-child+html .demo {color: green;}/* 仅仅IE7浏览器 */.demo {      color: gray; /* 基本的 */    color: pink\9; /* IE9以下(IE 8 及低于IE8版本 )其中9不能变成其他数、否则失效*/    *color: green; /* IE8以下(IE 7 及低于IE7版本) */    _color: blue; /* IE 6 */}

2.条件注释

注:if 运算符 IE 版本号,运算符如果省略将意味着等于,lt(小于)、gt(大于)、lte(小于或等于)、gte(大于或等于)<!--[if lt IE 7]>版本小于IE7将看到这行<![endif]--><!--[if lte IE 7]>版本小于或等于IE7将看到这行<![endif]--><!--[if IE 7]>版本如果是IE7将看到这行<![endif]--><!--[if gt IE 7]>版本大于IE7将看到这行<![endif]-->用法1:<!--[if IE 7]><style type="text/css"> /* 针对IE7定义的样式 */</style><script type="text/javascript"> /* 针对IE7js */</script><![endif]-->用法2:<!--[if lt IE 7 ]> <html class="ie6"> <![endif]--><!--[if IE 7 ]> <html class="ie7"> <![endif]--><!--[if IE 8 ]> <html class="ie8"> <![endif]--><!--[if IE 9 ]> <html class="ie9"> <![endif]--><!--[if (gt IE 9)|!(IE)]><!--> <html> <!--<![endif]-->可以在直接在样式表添加.box {background: gray; }/* 普通 */.ie8 .box { background: pink;}/* IE8 */.ie7 .box { background: green;}/* IE7 */.ie6 .box { background: blue;}/* IE6 */


0 0
原创粉丝点击