Can you please let me know how I can force CSS to make the line-through
property wider than element width
?
For Example
<h3 style="text-decoration:line-through">50</h3>
and result looks like now how I can make the line wider than element to be more obvious?
Like
in html Nested Div's<div><div></div></div>
You can use
which is a cheesy way to go forDemo
Or you can do is, use
:before
and:after
pseudo withcontent
propertyDemo
Note: Using a general selector here, consider using
class
or anid
to target the element specifically, also, if your text is between other text, consider wrapping that in a span and than use:before
and:after
overspan
.Briefing an answer here with solution that uses CSS Positioning techniques, using which you can also control the thickness of the strike through..
Here, am positioning the child element
absolute
to the parent element. So make sure you declareposition: relative;
on parent. Rest,:after
pseudo handles the rest and also be sure that you usecontent: "";
, though it's blank, it's mandatory.Demo 3 (Using CSS Positioning)