HTML Element: del

The HTML <del>
element represents deleted or removed content within a document, and it is typically used with the <ins>
element to show modifications or changes made.
Here are some everyday use cases:
-
Track edits and revisions: When collaborating on a document or implementing some version control system, the
<del>
element can be used to mark content deleted or removed from a previous version. This helps users understand the evolution of the document and highlights specific changes made. -
Document change history: In documentation or historical records, you can employ the
<del>
element to show outdated or deprecated information. It allows readers to see the original content while emphasizing that it has been removed or superseded. -
Highlight corrections or errors: When correcting errors or providing updated information, you can use the
<del>
element to strike through incorrect or outdated content while presenting the corrected content using other elements like<ins>
or simply plain text. -
Styling purposes: The
<del>
element can also be used for stylistic purposes to achieve a strike-through effect on specific content, even if it does not represent actual deletions or removals. This can be helpful for decorative or visual design purposes.
Syntax
1 |
<del>Deleted content goes here</del> |
Example
This example demonstrates the usage of the <del>
element to strike through and indicate the deletion of the “old version” of a document. In contrast, the HTML <ins>
element (inserted) highlights the insertion of the “new version.”
Attributes
The <del>
element has no specific attributes. It inherits common global attributes that apply to most HTML elements, such as class
, id
, style
, and title
. Global attributes provide additional styling, identification, or tooltip information for the <del>
element.
Content
The <del>
element can accept various types of content, including text, inline elements, or other HTML elements. It is used to enclose any content which has deleted or removed from the document.
Did You Know?
- The
<del>
element is often styled with a strike-through effect by default, although the appearance can be customized using CSS to suit the design requirements of a webpage. - The
<del>
element is commonly used in conjunction with the<ins>
element to represent changes made to a document, such as tracking edits or revisions. - When using the
<del>
element, providing additional context or explanation is recommended to clarify why the content has been deleted. This can be done through surrounding text or other elements to provide further details.
Learn More
- To learn more about the
<del>
element, you can check out the official HTML specification.