W3docs

HTML <del> Tag

The <del> specifies the part of the text deleted from the document. Attributes of the <del> tag and usage examples.

The <del> tag specifies a part of the text that was deleted from the document. Browsers display this text as a strikethrough. To indicate a new version of the text, we use the <ins> tag, the content of which is displayed in the browser as underlined.

Tip

For displaying the text as underlined, you can use the CSS text-decoration property with the "underline" value.

Modern screen readers typically announce deleted text automatically. If additional context is needed, use aria-label or aria-describedby instead of CSS content.

Syntax

The <del> tag comes in pairs. The content is written between the opening (<del>) and closing (</del>) tags.

Example of the HTML <del> tag:

HTML <del> Tag

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <p>My favorite color is <del style="color:#8ebf42;">green</del> <ins style="color:#1c87c9;"> blue</ins>!</p>
  </body>
</html>

Result

del example

Example of the HTML <del> tag with the cite attribute:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <p>The <del cite="https://www.w3docs.com/learn-html/html-b-tag.html" style="color:#ff0000">b</del> <ins cite="https://www.w3docs.com/learn-html/html-strong-tag.html" style="color:#c10ccc;">strong</ins> tag being a logical tag is used to emphasize the importance of the text.</p>
  </body>
</html>

Example of the HTML <del> tag with the datetime attribute:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <p>The <del datetime="2023-10-25T14:30:00Z" style="color:#ff0000">old text</del> was replaced with new content.</p>
  </body>
</html>

Attributes

AttributeValueDescription
citeURLSpecifies the URL of the document, which explains why the text was edited or deleted.
datetimeYYYY-MM-DDThh:mm:ssTZDDefines the date and time of the deleted text.

The <del> tag also uses the Global Attributes and the Event Attributes.

Practice

Practice

Which are the correct usage(s) and features of HTML <del> tag according to the content on the specified URL?