可能重複:
How do I get this CSS text-decoration override to work?我不能重寫文字裝飾爲無?
Chrome和Firefox的陰謀挫敗我試圖與該行通過文字修飾一個TD,有時跨度禁用,像這樣:
<style type="text/css">
tr.st td {
text-decoration: line-through;
}
tr.st td span.unstrike{
text-decoration: none;
background:yellow;
}
tr.st td span#unstrike-id{
text-decoration: none;
background:yellow;
}
tr.st td span.unstrike-important{
text-decoration: none ! important;
background:yellow;
}
</style>
<table border>
<tbody>
<tr>
<td>normal</td>
</tr>
<tr class="st">
<td>struck out</td>
</tr>
<tr class="st">
<td>struck out <span class="unstrike">unstrike class: shouldn't I be normal?</span></td>
</tr>
<tr class="st">
<td>struck out <span id="unstrike-id">unstrike-id identifier. Shouldn't I be normal?</span></td>
</tr>
<tr class="st">
<td>struck out <span class="unstrike-important">unstrike-important: shouldn't I be even more normal?</span></td>
</tr>
</tbody>
</table>
我眯着眼睛看規範,我不明白。
文本破壞的特例?是什麼賦予了?
演示here
哇,這很有趣,看起來'文字修飾'被應用到整個道明的內容,而忽略了它下面的任何東西。從來沒有見過。 –
看到這個答案:http://stackoverflow.com/a/1261974/698179 - 在你所有的'td'中放置'span'可能會更好,並且將樣式單獨作爲子元素應用。 –
是的,我現在看到它,雖然我認爲這是最好的先例:http://stackoverflow.com/questions/1823341/how-do-i-get-this-css-text-decoration-override-to-work/1823388#1823388 – djsadinoff