I am trying to find a way to have a strikethrough over text, such as the one possible with the text-decoration property, however I’m trying to make the line extend past the text to the rest of the encapsulating div, rather than just through the text itself.
I have tried using the text-decoration property, adjusting the width of the text object, and so on, but haven’t found anything that works.
2
Answers
You can use a pseudoelement like
::after
to achieve that, the container’s position should be set torelative
, and the position of the pseudoelement should be set toabsolute
so that it can position itself.You can simulate this with a gradient:
If
lh
is not well supported you can manually set the line height: