HTML Del Tag
Throughout this post, we will discuss Tag del. Wishing it would satisfy the requirements for learning.
The <del> tag in HTML is used to indicate that text has been deleted or removed from a document. When used, the <del> tag adds a strikethrough effect to the text that it encloses, indicating that it has been deleted.
The following text includes a deleted part and a new part inserted:
Example: 
Apply CSS to style <del> and <ins>:
Example: 
Here is an example of the del tag with the javascript function:
Example: 
Example Explanation
In this example, the text “This part of the sentence is incorrect” is wrapped in the <del> element and is given an ID of “del-text” so that it can be accessed with JavaScript. The text is also given a datetime attribute of “2022-01-01T09:00:00” to indicate when it was deleted.
Uses and Definition
The Tag del <del> indicates text taken out of a document. Deleted text is usually highlighted with a line in the browsers.
Browser Compatibility
Element | |||||
---|---|---|---|---|---|
<del> | Yes | Yes | Yes | Yes | Yes |
Attributes
Attribute | Value | Overview |
---|---|---|
cite | URL | Indicate a URL to a document that provides information about why the text has been deleted or changed. |
datetime | YYYY-MM-DDThh:mm:ssTZD | This attribute represented when the text was deleted or changed. |
Global Attributes
The <del> Tag is compatible with HTML Global Attributes.
Event Attributes
The <del> Tag accommodates HTML Event Attributes as well.
CSS Default Settings
The <del> element will typically be displayed with the following default values in many web browsers:
del { text-decoration: line-through; }
HTML Del Tag Advantages
The <del> tag in HTML has several advantages that make it a useful tool for web developers and designers. Here are some of the advantages of using the del tag:
- The <del> tag can help improve the clarity of a document by indicating that certain text has been deleted or removed. This can be particularly useful in legal documents, contracts, or other documents where accuracy and clarity are important.
- By using the <del> tag to indicate deleted text, you can help make your content more accessible to users with disabilities. For example, users who rely on screen readers can be informed that certain text has been deleted, which can improve their understanding of the content.
- The <del> tag can also be used to improve the search engine optimization (SEO) of a web page. By indicating that certain text has been deleted, you can avoid the use of strike-through styling or other visual cues that may not be as clear to search engines.
- The <del> tag can be useful in collaborative environments where multiple people may be editing a document. By indicating deleted text, it can help avoid confusion and misunderstandings about what changes have been made to the document.