<del> tag is an HTML element that is used to indicate text that has been deleted or removed from a document. When used, the text within the
<del> tag is displayed with a strikethrough, indicating that it has been deleted.
Here’s an example of how to use the
<p>My favorite color is <del>green</del> blue.</p>
In the example above, the text “green” has been crossed out using the
<del> tag, indicating that it has been removed and replaced with the word “blue.”
Sure, here are some additional details about the
- Accessibility: When using the
<del>tag, it’s important to make sure that the text remains accessible to all users, including those who use assistive technologies such as screen readers. To ensure accessibility, it’s recommended to provide additional context and explanation for why the text has been deleted. This can be done using the
titleattribute or by adding an explanation in the surrounding text.
- Attributes: The
<del>tag supports a number of attributes that can be used to provide additional information about the deleted text. These include the
citeattribute, which can be used to provide a URL that references the source of the deleted text, and the
datetimeattribute, which can be used to specify the date and time when the text was deleted.
- Visual representation: The visual representation of the
<del>tag can vary depending on the web browser and the CSS styles applied to the page. By default, the text within the
<del>tag is displayed with a strikethrough, but this can be customized using CSS.
- Difference from
<strike>tag is a deprecated HTML element that is similar to the
<del>tag in that it also displays text with a strikethrough. However, the
<strike>tag is no longer recommended for use in modern web development and should be avoided. The
<del>tag is the recommended way to indicate deleted text.