我的HTML是:變化劃掉文字顏色
<html>
<body>
<div id="example">this is example</div>
</body>
<html>
我的CSS是:
#example{text-decoration: line-through;color:#ccc;}
我收到了,把這樣
但我想像這樣
但我不能。幫助我這樣做。
我的HTML是:變化劃掉文字顏色
<html>
<body>
<div id="example">this is example</div>
</body>
<html>
我的CSS是:
#example{text-decoration: line-through;color:#ccc;}
我收到了,把這樣
但我想像這樣
但我不能。幫助我這樣做。
顏色適用於直通和文本。你需要像巢一樣嵌套。
<span style="text-decoration: line-through; color: red;">
<span style="color: #CCC;">text with red linethrough and black text</span>
</span>
來源:http://www.savio.no/artikler/a/335/different-font-color-than-line-through-color-with-css
這是一個例子,它工作正常。
HTML:
<div id="example">
this is example
<span></span>
</div>
CSS:
#example{
color:#ccc;
font-size: 20px;
position: relative;
display: inline-block;
}
#example span {
position: absolute;
width: 100%;
border-top: 1px solid red;
left: 0;
top: 50%;
}
不工作時,有一個以上的線,雖然 – martin 2014-11-19 11:45:38
http://stackoverflow.com/questions/1107551/css-strikethrough-different-color- from-text – 2012-01-04 08:22:57