HTML <del> Tag
To specify the deleted/removed text in a document, the HTML <del> tag is used. Thus, it acts as a Markup for the deleted text by striking a line through the deleted text. The default markup can be changed using the CSS property. The HTML <ins> tag is often used with the <del> tag to specify the inserted text.
Syntax:
<del>Content</del>
Example 1:
<!DOCTYPE html> <html> <body> <p>Hello <del>Ladies and Gentleman</del> <ins>World</ins>!!</p> </body> </html>
Explanation:
In the above example, we are deleting a certain text from a document and we are inserting some other text in place of it.
Example 2: Using CSS.
<!DOCTYPE html> <html> <head> <title>Example</title> <style> del{ background-color: lightgray; color: red;} ins{ color:blue; } </style> </head> <body> <h4>Hello Ladies and Gentleman!!</h4> <p>Hello <del>Ladies and Gentleman</del> <ins>World</ins>!!</p><br> <h4>Today is a great day for playing Video Games.</h4> <p>Today is a great day for <del>playing Video Games</del> <ins>learning HTML</ins>.</p> </body> </html>
Explanation:
In the above example, we are deleting a certain text from a document and we are inserting some other text in place of it. Here, we are also using CSS properties to style the contents of the HTML <del> and <ins> tags.
Tag Specific Attributes:
Attribute | Value | Uses |
cite | URL | Used to define the URL of the source that contains the explanation of the reason for the text removal or deletion of the text. |
datetime | YYYY-MM-DDThh:mm:ssTZD | Used to define the date and time of the text removal. or deletion of the text. |
Global Attributes:
The Global attributes are supported by the HTML <del> tag.
Event Attributes:
The Event attributes are supported by the HTML <del> tag.
Supporting Browsers:
Chrome, IE, Firefox, Opera, and Safari.