我继承了一个 CSS 样式表,在一些地方它做了如下的事情:
margin:7px 0 0 0;
/margin-top:9px;
或者
background: url(../images/list-hover.png) 0 0 no-repeat;
/background:url(../images/lists-hover.png) 0 2px no-repeat;
有人知道正斜杠在做什么吗?
它的目标是LTE IE7。这种 hack 不像 IE6 下划线那样广为人知。
#myelement {
background:red; /*Should show as red in all browsers, expect IE6 and IE7 because...*/
/background:yellow; /*IE7 should have yellow*/
_background:green; /*IE6 should have green*/
}
您可以将反斜杠设置为几乎任何您真正想要的,期待下划线 _ 因为它将针对 IE6。我个人使用 $ 。
编辑:
我在那里也包含了 IE6 技巧,因为任何 IE7 及以下版本都将采用 / 属性,除非你也有 _ 属性。
要以 IE8、IE7 和 IE6 为目标,您需要具有上述顺序。