2016-04-17 45 views

回答

2

你可以做一些CSS技巧來做到這一點是這樣的:

.line-through-text { 
 
     position: relative; 
 
     color: blue; 
 
    } 
 

 
    .line-through-text:before { 
 
     border-bottom: 2px solid orange; 
 
     position: absolute; 
 
     content: ""; 
 
     width: 100%; 
 
     height: 50%; 
 
    }
<h2> 
 
Hello There! <span class="line-through-text">This is wrong,</span> This is correct 
 
</h2>

1

對不起,我會後在一分鐘內正確的答案:)(誤讀)

var pOut = $("span").css("text-decoration"); //line-through 
 
if (pOut == "line-through") { 
 
    $("span").css("color", "red"); 
 
}
span { 
 
    text-decoration: line-through; 
 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<p>hello <span>crazy world</span> world!</p>

編輯:

span { 
 
    position: relative; 
 
    font-size: 50px; 
 
    padding: 0; 
 
    margin: 0; 
 
} 
 
span.redline:after { 
 
    content: ''; 
 
    position: absolute; 
 
    width: 100%; 
 
    height: 100%; 
 
    top: 55%; 
 
    left: 0; 
 
    border-top: rgba(255, 0, 0, 1) 4px solid; 
 
}
<p>hello <span class="redline">crazy</span> world!</p>

相關問題