You can use which is a crappy way of transitioning to
<div> HELLO </div>
Demo
Or you can do this, use :before and :after pseudo with the content property
Demo
div { text-decoration:line-through; } div:before, div:after { content: "\00a0\00a0"; }
Note Using a common selector, consider using a class or id to customize the element, also if your text is between different text, consider wrapping in between and use :before and :after over span .
Clarify the answer here with a solution using CSS positioning techniques, with which you can also control the thickness of the stroke.
Here I put the absolute child element in the parent element. So make sure you declare position: relative; for the parent. Rest,: :after pseudo handles the rest, and make sure you use content: ""; Although it is empty, it is required.
Demo 3 (using CSS positioning)
div { position: relative; display: inline-block; padding: 0 10px; margin: 10px; } div:after { content: ""; position: absolute; border: 2px solid #000; top: 50%; margin-top: -1px; width: 100%; left: -2px; }
source share