Is it possible to change color of the line on wrapped text? I mean, e.g, a black text and a red line!?
{CSS} A different color for the line which is drawn on a text by "text-decoration: line-through"?
68 Views Asked by mini At
2
There are 2 best solutions below
0
On
Sorry, i'll post correct answer in a minute :) (misread)
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>
Edit:
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>

You can do some CSS tricks to do it like this: