我有一個文章頁面,我正在進行小的CSS更改,例如頁邊距和字體大小。我的代碼必須能夠被Internet Explorer 8及以上版本支持。問題是,我正在使用一些IE8不支持的CSS選擇器。如何在不使用:not selector的情況下編寫我的CSS代碼?如何編寫CSS代碼而不使用:不是選擇器?
樣品文章頁面HTML
<div class="entry">
<h3 class="social-title>Share This Article </h3>
<div class="social-content>
<table>
<td><a href="twitter.com"><img class="" src="twitter.png"><span class="">Twitter</span></a></td>
<td><a href="facebook.com"><img class="" src="facebook.png"><span class="">Twitter</span></a></td>
</table>
</div>
<!-- The article would start here -->
<p class="category_row"><h1 class="category-title>Lifestyle</h1></p>
<p style="margin: 0in 0in 0.0001pt; line-height: 13.5pt; vertical-align: baseline;"><a href="example.com/article.html"><img alt="" style="float: left;" src="example.jpg"></a>Article goes starts here...</p>
<p style="margin: 0in 0in 0.0001pt; line-height: 13.5pt; vertical-align: baseline;">Second paragraph</p>
Third paragraph
</div>
CSS我使用
.entry p:not(.category_row) {
font-size: 14px;
line-height:22px;
}
img (margin: 10px)
到目前爲止例子,如果我想邊距添加到在文章部分圖片,我如何編寫CSS代碼以便它隻影響文章部分中的圖像,而不影響<div class="social-content">
中的圖像?不用:不?
另外,如何編寫CSS代碼以將文章的字體大小更改爲14px的字體大小和22px的行高?不影響上面的所有內容(不在文章部分)?
對不起,如果這是混亂,但我會澄清更多,如果需要!
你是否反對使用一些JavaScript來填補支持?如果沒有...那麼你的解決方案是selectivizr.js - http://selectivizr.com/ – Michael
沒有JavaScript在這裏。由於我可以訪問的代碼的某些限制,我只能使用CSS。 – user3097331
除了通過給這些段落提供一個類並且增加特異性以外,沒有其他的動態解決方案沒有使用:不是。所以它要麼不支持IE瀏覽器,要麼在其中粘貼一個JavaScript庫... – Michael