Open In App

How to set date and time when the text was deleted using HTML ?

The <del> tag in HTML stands for delete and is used to mark a portion of text which has been deleted from the document. The deleted text is rendered as strikethrough text by the web browsers although this property can be changed using CSS text-decoration property. The <del> tag requires a starting and ending tag.

The <del> datetime attribute is used to specify the date and time of the deleted text.



Syntax:

<del datetime=""> Contents... </del>

Attribute Values: This attribute contains single value YYYY-MM-DDThh:mm:ssTZD which is used to specify the date and time when the text was deleted.



The explanation of datetime components are listed below:

Example:




<!DOCTYPE html>
<html>
 
<head>
    <title>
        How to specify the date and time
        when the text was deleted?
    </title>
 
    <style>
        del {
            color: red;
        }
 
        ins {
            color: green;
        }
    </style>
</head>
 
<body style="text-align:center">
 
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>
 
    <h3>
        How to specify the date and time
        when the text was deleted?
    </h3>
 
     
     
<p>
        GeeksforGeeks is a <del
        datetime="2018-11-21T15:55:03Z">
        mathematical</del> <ins>computer</ins>
        science portal
    </p>
 
 
</body>
 
</html>

Output:

Supported Browsers:


Article Tags :