Open In App

HTML del Tag

Last Updated : 28 Nov, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

The HTML <del> tag is used to indicate text that has been deleted from a document.

  • It visually represents this deletion by striking through the text, which helps in tracking changes or revisions in documents.
  • It provides semantic meaning for content that has been intentionally removed, such as in editing or version control scenarios.
HTML
<!DOCTYPE html>
<html>

<body>
  <p>
    GeeksforGeeks is a
    <del>mathematical</del>
    science portal
  </p>
</body>

</html>

Syntax

<del attr="values"> Contents... </del>

Attributes

Attributes

Description

cite

It is used to specify the URL of the document or message which denotes the reason for deleting the text.

datetime

It is used to specify the date and time of the deleted text.

<del> tag with datetime attribute

HTML
<!DOCTYPE html>
<html>

<head>
  <style>
    del {
      color: red;
      text-decoration: line-through;
    }
  </style>
</head>

<body>
  <p>
    The project deadline has been changed from
    <del datetime="2024-01-03T12:00:00Z">January 15, 2024</del>
    to January 30, 2024.
  </p>
  <p>
    The following feature was removed:
    <del datetime="2024-01-05T12:00:00Z">User authentication via email</del>.
  </p>
</body>

</html>

HTML <del> Tag – FAQs

When should I use the <del> tag?

Use the <del> tag when you want to show that content has been removed or edited out, such as in revision histories or legal documents.

Can the <del> tag be styled with CSS?

Yes, the <del> tag can be styled using CSS like any other HTML element, allowing you to control the appearance of the deleted content.

What is the difference between the <del> tag and the <s> tag?

The <del> tag semantically represents content that has been removed, while the <s> tag indicates text that is no longer relevant or accurate without suggesting it was deleted.

What is the cite attribute used for in the <del> tag?

The cite attribute can be used to provide a URL that explains why the text was deleted or links to more information about the change.

Can the <del> tag be nested within other tags?

Yes, the <del> tag can be used inside other tags like <p>, <li>, or even combined with the <ins> tag to show both deletions and insertions.


Next Article

Similar Reads

three90RightbarBannerImg
  翻译: