Strikethrough text in HTML is very common and you might have come across its implementation on e-commerce platforms where the original price is strikethrough and the discounted price is listed. Another, usage of strikethrough text is common in documents where the difference is highlighted between old and new text while comparing document revisions.
Similar to word documents, text inside HTML elements can be strikethrough using a couple of different ways described below.
<del> semantic element which can be used to highlight the portion of text that was deleted.
<del> element can be used with
<ins> to highlight new text that has been inserted in the document. Let’s see its application in the following example:
<s> functions similar to
<del> element however their is difference in the meaning that these tags convey. When text is not relevant to document anymore, we should be using
<s> element, and when text is deleted from the document we should be using the
Striking through in CSS can be achieved using the
text-decoration: line-through property is defined on text element, the horizontal line is placed over text.
<strike> tag is obsolete and was deprecated in HTML5. The HTML
<strike> tag places a horizontal line over text.
The presence of the
<strike> element is not announced by most screen reading technology in its default configuration. It can be made to be announced by using the CSS content property, along with the
::after pseudo-elements. Source MDN