【发布时间】:2015-03-14 07:34:21
【问题描述】:
我在开发过程中一直使用这种技术来创建 IE 条件样式表:
http://clock.co.uk/blog/handling-ie-with-stylus
基本上,它允许我在非 IE 样式旁边编写 IE 特定的 CSS,它会自动将其拆分到一个新文件中。在大多数情况下,它很棒,但如果我要更改它的一件事,那就是它创建了 CSS 文件的 2 个完整副本,只有一个副本包含额外的 IE 特定样式。我想要做的是只有 IE 特定的样式出现在单独的文件中。
所以如果我在 Stylus 中做这样的事情
/* styles.styl */
.myDiv
+ie(8)
width: 100px
background: #000
color: red
.other
display: block
width: 10px
我希望这 2 个文件看起来像这样:
/* styles.css: */
.myDiv {
background: #000;
color: red;
}
.other {
display: block;
width: 10px;
}
/* styles-ie8.css: Just the IE specific styles */
.myDiv {
width: 100px;
}
而不是 style-ie.css 以这样的方式结束:
/* styles-ie8.css: */
.myDiv {
width: 100px; /* <-- includes the extra IE-specific style along with everything else */
background: #000;
color: red;
}
.other {
display: block;
width: 10px;
}
只是好奇这是否可能,谢谢!
【问题讨论】:
标签: css internet-explorer conditional stylesheet stylus