2012-01-04 28 views
11

Benim html:Değişim çarparak geçme metin rengi

<html> 
<body> 
    <div id="example">this is example</div> 
</body> 
<html> 

Benim css geçerli:

ama bu
out-put image
gibi out-put alıyorum
#example{text-decoration: line-through;color:#ccc;} 

istiyoruz bu gibi
i am trying to do like this ama yapamam. Böyle yapmama yardım et.

+3

http://stackoverflow.com/questions/1107551/css-strikethrough-different-color- from-text –

cevap

20

Renk, satır boyunca ve metin için geçerlidir. Senin gibi yuva yapmalısın.

<span style="text-decoration: line-through; color: red;"> 
<span style="color: #CCC;">text with red linethrough and black text</span> 
</span> 

Kaynak: http://www.savio.no/artikler/a/335/different-font-color-than-line-through-color-with-css

+1

Orijinal cevaba link verirseniz iyi olur. http://stackoverflow.com/a/1107556/293712 – Maheep

+0

Sonra bu bağlantı referansı yardımcı olurdu. Kaynağına kredi vermenin iyi bir alışkanlığı. – Maheep

+1

güncellendi yanıt. –

0

Bu bir örnektir, doğru çalışır.

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%; 
} 

http://jsfiddle.net/amkrtchyan/RHPHX/1/

+0

çalışmıyor birden fazla satır olsa var – martin