How to mark deleted text in HTML?


We use <del> tag, to delete a text in HTML. This tag mark strike on the text which is to be delete from the document.

We can also use the style attribute, to strike a text in HTML. The style attribute specifies an inline style for an element. This attribute is used inside the HTML <p> tag, with the CSS property text-decoration property.

Syntax

Following is the syntax to delete a text in HTML.

<del> The content to be deleted </del>

Example

Following is the example program to delete a text in HTML.

<!DOCTYPE html> <html> <head> </head> <body> <p>DLF stands for<del>Delhi Land and Finance.</del></p> <p>Delhi Land and Finance is one of the largest commercial real estate developer in India.</p> </body> </html>

Example

In the example below, we used <del> tag on a particular text inside the <h1> tag.

<!DOCTYPE html> <html> <head> <title>HTML u tag</title> </head> <body> <h1>Welcome to <del> Disney land </del> Kids.</h1> </body> </html>

Marking deleted text by inline CSS

Using CSS property for deleting a text in HTML.

Syntax

Following is the syntax to delete a text in HTML using CSS property.

<p style="text decoration:line-through;">The content to be underlined</p>

Example

Following is the example program to delete a text in HTML using CSS property.

<!DOCTYPE html> <html> <head> </head> <body> <p>DLF stands for</p><p style="text-decoration:line-through;">Delhi Land and Finance</p> <p>Delhi Land and Finance is one of the largest commercial real estate developer in India.</p> </body> </html>

Updated on: 11-Nov-2022

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements