IE6支持在css样式中使用 expression表达式,所以,可以针对IE6,使用expression表达式,通过js动态给对应的元素添加新的div元素,具体操作如下。
.tabs {
*zoom: expression(
this.runtimeStyle.zoom="1",
this.insertBefore(
document.createElement("div"),
this.childNodes[0]
).className="before",
this.appendChild(
document.createElement("div")
).className="after"
);
}
...
.tabs::before, .tabs .before {
content: '';
display: inline-block;
width: 10px;
height: 20px;
background-color: #eee;
}
.tabs::after, .tabs .after {
content: '';
display:inline-block;
width: 10px;
height: 20px;
background-color: #c0c;
}
网友评论