HTML <del> Tag
The HTML <del>
tag represents deleted text in an HTML document.
Marking text as deleted is often used for determining differences between multiple versions of the same document. Browsers will typically strike a line through deleted text.
Syntax
The <del>
tag is written as <del>
</del>
with the deleted text inserted between the start and end tags.
Like this:
Examples
Basic Usage Example - A "To Do" List
The <del>
tag can be used in a "to do" list to markup items that have been done.
Like this:
Date & Time
The datetime
attribute allows you to add a date and (optionally) a time. This attribute is mainly intended for private use (e.g. by server-side scripts collecting statistics about a site's edits), but it could potentially be displayed to users.
Here, we can add date and time information to items that have been crossed off our "to do" list.
Citations
You can add a citation using the cite
attribute. The value of this attribute must be the URL of a document that explains the change. This attribute is not intended for readers of the document. Rather, it is intended for private use (e.g. by server-side scripts collecting statistics about a site's edits).
Inserting New Text
Deleted text is often accompanied by inserted text. This often happens when out-dated information needs to be deleted and new information is added. To insert new text, use the <ins>
tag.
Deleting Table Rows &/or Columns
To delete a table row or column, you need to apply the <del>
tag to the content within those rows/columns. You can't simply enclose a <tr>
tag or <td>
tag within <del>
tags.
Delete Table Row
Delete Table Row
Attributes
Attributes can be added to an HTML element to provide more information about how the element should appear or behave.
The <del>
element accepts the following attributes.
Attribute | Description |
---|---|
cite | Indicates a source that should indicate the reason for the change. |
datetime | Date and time of change. |
Global Attributes
The following attributes are standard across all HTML elements. Therefore, you can use these attributes with the <del>
tag , as well as with all other HTML tags.
accesskey
autocapitalize
class
contenteditable
data-*
dir
draggable
hidden
id
inputmode
is
itemid
itemprop
itemref
itemscope
itemtype
lang
part
slot
spellcheck
style
tabindex
title
translate
For a full explanation of these attributes, see HTML 5 global attributes.
Event Handlers
Event handler content attributes enable you to invoke a script from within your HTML. The script is invoked when a certain "event" occurs. Each event handler content attribute deals with a different event.
onabort
onauxclick
onblur
oncancel
oncanplay
oncanplaythrough
onchange
onclick
onclose
oncontextmenu
oncopy
oncuechange
oncut
ondblclick
ondrag
ondragend
ondragenter
ondragexit
ondragleave
ondragover
ondragstart
ondrop
ondurationchange
onemptied
onended
onerror
onfocus
onformdata
oninput
oninvalid
onkeydown
onkeypress
onkeyup
onlanguagechange
onload
onloadeddata
onloadedmetadata
onloadstart
onmousedown
onmouseenter
onmouseleave
onmousemove
onmouseout
onmouseover
onmouseup
onpaste
onpause
onplay
onplaying
onprogress
onratechange
onreset
onresize
onscroll
onsecuritypolicyviolation
onseeked
onseeking
onselect
onslotchange
onstalled
onsubmit
onsuspend
ontimeupdate
ontoggle
onvolumechange
onwaiting
onwheel
Most event handler content attributes can be used on all HTML elements, but some event handlers have specific rules around when they can be used and which elements they are applicable to.
For more detail, see HTML event handler content attributes.