首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > CSS >

css 中的星号和上划线

2012-09-09 
css 中的星号和下划线?Differentiating between IE 6 and below and IE 7?Firstly we can target IE 6 and

css 中的星号和下划线

?

Differentiating between IE 6 and below and IE 7

?

Firstly we can target IE 6 and IE 7 separately using the underscore hack and far less well documented star property hack (commonly mistaken for the star HTML hack).

?

.box {

? ?background: #00f; /* all browsers including Mac IE */

? ?*background: #f00; /* IE 7 and below */

? ?_background: #f60; /* IE 6 and below */

? ?padding: 7px;

? ?color: #fff;

}

?

View Example

?

In this example all non IE browsers (which also includes Mac IE) see the first background rule. This sets the box colour to blue. Both IE 6 & 7 then see the next rule (prefixed with a star) which overrides the first rule and sets the background colour to red. Finally IE 6 and below also see the final rule (prefixed with an underscore) and set the background colour to orange.

热点排行