有沒有辦法從CSS內部調用IE條件?我想避免從代碼中調用一長串IE瀏覽器的css文件。鞏固CSS IE調用
<!--[if IE 7]>
<link href="ie7.css" rel="stylesheet" type="text/css" />
<![endif]-->
<!--[if IE 8]>
<link href="ie8.css" rel="stylesheet" type="text/css" />
<![endif]-->
<!--[if gt IE 8]>
<link href="ie-gt-8.css" rel="stylesheet" type="text/css" />
<![endif]-->
,並希望能有一個呼叫
<!--[if IE]>
<link href="ie.css" rel="stylesheet" type="text/css" />
<![endif]-->
,並有CSS文件中的條件語句。這是可能的還是Paul Irish的路要走?
我試圖採用「高級規則」建議在this article
#column_right {
float:left;
width:250px;
margin-left:-250px;
[if IE 6] ie6: 100%;
[if lt IE 6] lt-ie6: 100%;
[if lte IE 6] lte-ie6: 100%;
[if ! lte IE 6] not-lte-ie6: 100%;
}
#footer {
clear: left;
width: 100%;
[if IE 5.0] padding: 10px 0px;
[if IE 5.5] margin-bottom: 40px;
}
[if IE 5] .box {
width: 200px;
padding: 100px;
margin: 100px;
}
但這並不爲我工作。我嘗試了一些基本的東西,比如
[if IE 7] background-color: red;
[if IE 8] background-color: yellow;
這是可能的。看到我的回答 –
是的,你可以做到這一點。那是我忘記的一個。但我更專注於有條件的評論_in_ CSS。這是不可能的。但是你的風格會解決問題。 – Ktash