HTML Basics: Know Your Text – The Essential Guide to Deleted vs. Strike-Through Formatting

Deutsch

Strike-through Text: DEL and S Tag – What is the Difference?

The two HTML tags DEL and S are Inline Elements. This means: By default, these two tags do not generate an automatic line break.

The output of DEL (deleted) and S (strike-through) is the same by default. These HTML tags are used to strike-through a single word or a range of text. Both tags draw a thin horizontal line in the middle over the text and indicate it as deleted or no longer valid. However, there is a very important difference between these two HTML tags.

The HTML <del> Tag

The DEL tag is used to mark up a range of text as deleted. Text tagged this way will remain in the document to show the history of changes.

In practice, the <del> tag is very rarely used, since strike-through makes the web page difficult to read and the user gets almost no additional information.

A part of text marked up as deleted begins with <del> and must end with the closing tag </del>.

Typically, DEL is used in conjunction with the INS tag for expired offers and promotions, or canceled event dates.

The <del> tag indicates a text as deleted

The event is scheduled for <del>Wednesday, March 12, 2025</del>&nbsp; <ins><b><mark>Wednesday, March 26, 2025</mark></b></ins>.

The <del> tag is used to indicate the old date as deleted. The new date is inserted. It is also highlighted in color and displayed in bold. With &nbsp; a protected space is inserted between the two dates in order to separate them more clearly from each other.

The term deleted is semantically not optimal, since the old date is not removed, but corrected.

The event is scheduled for Wednesday, March 12, 2025  Wednesday, March 26, 2025.
     

A DEL tag may not be placed directly inside an INS tag.

The HTML <s> Tag

In earlier versions of HTML, there was a STRIKE tag that could be used to strikethrough text. The new S tag in HTML5 is a replacement for the STRIKE tag, which is no longer valid. It is equipped with a touch of semantics.

The strikethrough range of text begins with <s> and must be closed with </s>. Text marked up with s indicates content that is no longer valid and has been updated.

A practical use of the S tag is an old price that is crossed out to draw attention to an offer or a price reduction. The use of S also makes sense for limited offers and durations. For example: only 5 days left.

This HTML code is better. The <s> tag is used to strike through the text that is no longer valid. Then the corrected date is inserted. The example will highlight it by using color and printing in bold.

The <s> tag is used to strike through text that is no longer valid

The event is scheduled for <s>Wednesday, March 12, 2025</s>&nbsp; <b><mark>Wednesday, March 26, 2025</mark></b>.

With &nbsp; a protected space is inserted again between the two dates in order to separate them more clearly from each other.

The event is scheduled for Wednesday, March 12, 2025  Wednesday, March 26, 2025.
     

In practice, the DEL tag is rarely used, except for prices or dates that are no longer valid, because it provides very little additional information to the user.

In contrast to the del tag, the s tag still has a certain amount of information for the user.

Style the <del> and <s> tags with CSS according to your specific needs.