LAST UPDATED: JUNE 2, 2020
HTML del Tag
In HTML, we use the <del>
tag to indicate that the enclosed text has been deleted from the document. This tag is used to display the deleted text, which is displayed with a strike through the text.
-
The <del>
tag is used to provide information about changes and updates made to a document.
-
The web browser renders the enclosed text as strikethrough.
-
The <del>
tag comes under the category of Logical Style elements.
HTML <del>
Tag - Syntax and Usage
The <del>
tag requires the start(opening) tag and end(closing) tag.
Following is the syntax for using the <del>
tag in your HTML code:
<del>
deleted text
</del>
HTML <del>
Tag Basic Example
Below we have a basic example showing how we can use the HTML <del>
tag,
HTML <del>
Tag Attributes
This element does not have any specific attributes although this element supports Global attributes and Event attributes.
Some other important attributes used along with <del>
tag are given below:
1. cite:
-
This attribute is used to indicate the reason for deletion.
-
The value of this attribute is URL(Universal Resource Locator), which points to some other document that describes the deleted text.
Here is an example,
<p><del cite="/path/to/reason_for_deletion.html">This text has been deleted.</del></p>
2. datetime:
Here is an example,
<p><del datetime="2020-05-15T22:55:03Z">This text has been deleted.</del></p>
HTML <ins>
tag:
When we delete some text in a webpage, we can use the <del>
tag to show it and if there is some other text inserted in the place of the deleted text, we can show it on the webpage using the <ins> tag.
Let's take an example:
<p>We no longer sell <del>ProductX</del>, instead, we now have the new <ins>ProductY</ins>.</p>
Try using the <ins>
tag in the Code playground above and you will see that the text enclosed within the <ins>
tag is underlined.
Default CSS style for HTML <del>
tag
del {
text-decoration: line-through;
}
Browser Support for HTML <del>
tag
Following browsers support this attribute:
-
Firefox 1+
-
Google Chrome 1+
-
Internet Explorer 4+
-
Safari 1+
-
Opera 7+