HTML <del>
Tag
Concept
The <del>
tag in HTML is used to represent deleted text in a document. It allows you to show text that has been removed from the current version but was present in an earlier version. This can be particularly useful in collaborative documents or in scenarios where tracking changes is important.
Implementation
Example 1: Deleting a Part of Text
Here’s an example of how you can use the <del>
tag to show a deleted part of the text:
<p>A text with a deleted part: <del>This part is deleted</del>.</p>
Example 2: Deleting and Inserting Text
You can combine the <del>
tag with the <ins>
tag to show both deleted and inserted text:
<p>A text with a deleted part, and a new, inserted part: <del>Old text</del> <ins>New text</ins>.</p>
Try it out below
powered by Advanced iFrame. Get the Pro version on CodeCanyon.
Attributes
Global Attributes
The <del>
tag supports all the global attributes in HTML.
Event Attributes
The <del>
tag also supports all the event attributes in HTML.
Browser Support
Browser | Support |
---|---|
Chrome | Yes |
Firefox | Yes |
Safari | Yes |
Opera | Yes |
IE | Yes |
Default CSS Settings
Most browsers will display the <del>
element with the following default CSS settings:
del {
text-decoration: line-through;
}
Conclusion
The <del>
tag provides a semantic way to represent deleted text within a document.
It’s a useful tool for authors, editors, and content creators who want to track changes or show the evolution of a text over time