HTML del Tag: How to Mark Deleted Text in Pages

html del tag

The HTML del tag shows text that a user or author removed from a page. A browser shows this text with a line through it so readers see the old version. Writers use it in articles or notes.

Understand the HTML <del> Tag

The <del> tag is an inline element that marks text as removed. A line runs through the words so users notice what got deleted.

Here is the basic tag:

<p>This is <del>old</del> text.</p>

A browser will show the word “old” with a line through it inside the sentence.

The <del> tag helps readers see that a change took place in a document. A user can track edits or know that some detail no longer applies.

Hence, it is often used in online articles, tutorials, or notes where updates happen over time.

Here is a quick example:

<p>Price was <del>$50</del> now $40</p>

The tag makes it easy for users to notice that the old value no longer applies.

How to Style th <del> Tag with CSS

By default, the browser adds a line through deleted text. A developer can use CSS to change the look. For example, you can change the color, style, or add extra effect.

For example:

<style>
del {
  color: red;
  text-decoration: line-through;
}
</style>

<p>Old plan cost <del>$25</del> now $15</p>

This style makes the deleted words show in red with a strike line.

The Differences Between HTML <del> and <ins> Tags

The <del> tag shows text that got removed while the <ins> tag shows text that got added.

Feature<del><ins>
MeaningRemoved textAdded text
LookLine through wordsUnderline words
Use caseShow what no longer appliesShow new content or updates

Writers can use both tags in a document to show edits. For example, a blog post may use <del> for old prices and <ins> for new prices.

All major browsers support the <del> tag. Chrome, Firefox, Safari, Edge, and Opera show the line through the words without extra setup. Old browser versions may show it the same way since support for <del> has existed for years.

Examples of <del> Tag in HTML

Basic Price Update:

<p>Book cost <del>$30</del> now $20</p>

This code shows the old cost of a book with a line through it and the new cost after it. A user notices both values in one view and sees the change with ease.

Change in Task List:

<ul>
  <li><del>Buy milk</del></li>
  <li>Call John</li>
  <li>Finish report</li>
</ul>

This code shows a task list where one task has a line through it. The list lets a user track what task is done and what task remains open.

Use with <ins> for Document Update:

<p>Our site was <del>www.oldsite.com</del> <ins>www.newsite.com</ins></p>

This code shows both removed and added text in one line. The old domain has a line through it while the new one shows with an underline to mark the update.

Style for Better Display:

<style>
del {
  color: gray;
  font-style: italic;
}
</style>

<p>Old rule was <del>No outside food</del> now food is allowed</p>

This code changes the look of the <del> tag with gray and italic text. A user sees that the old rule no longer applies while the new rule remains easy to read.

Wrapping Up

You learned what the <del> tag is and how it works on web pages.

Here is a quick recap:

  • <del> shows text that got removed from a page.
  • You can style the tag with CSS to change its look.
  • <del> and <ins> work together on edits.
  • All major browsers support the <del> tag.

FAQs

How to use <del> tag in HTML?

You can wrap deleted text inside <del> to show it as removed. Example:
<p>This is <del>old text</del> in a sentence.</p>

What is the purpose of <del> tag in HTML?

The <del> tag shows that part of the text has been removed from a document. It often appears with a strike-through style by default.

How to style <del> tag with CSS?

You can change how <del> looks with CSS. Example:
<style>  
del {  
  color: red;  
  background-color: yellow;  
}  
</style>  

What is the difference between <del> and <ins> in HTML?

The <del> tag marks removed text. The <ins> tag marks inserted text. Both help track changes in documents.

Similar Reads

The canvas Tag in HTML: How to Draw Graphics with Examples

The HTML canvas tag draws shapes and images. It also helps you draw text with code. It gives control over…

HTML p Tag: How to Create a Paragraph in HTML

Paragraphs help group-related text. They build clear, readable pages. You use them to split ideas or topics. The HTML p…

HTML vs XHTML: Key Differences Every Developer Must Know

HTML and XHTML describe web pages. You must know the differences to write code that works across browsers. This article…

HTML Mark Tag: How to Highlight Text

The mark tag highlights text in HTML and shows that the text has relevance in the content. It adds a…

HTML track Tag: How to Add Subtitles to Videos

The track tag in HTML adds text tracks like subtitles and captions to media. It improves video access and helps…

HTML source Tag: How to Embed Media with Examples

The source tag in HTML helps load different media formats and screen sizes. You can use it inside many other…

HTML s Tag: How it Works with Examples

The HTML s tag places a line across text that has no longer value or does not hold importance. It…

HTML Form novalidate Attribute: How it Works with Examples

The form novalidate attribute in HTML lets you skip browser checks when you submit a form. You can control errors…

HTML pre Tag: How to Display Preformatted Text

The HTML <pre> tag keeps the original format of your text. It shows spaces and line breaks exactly as you…

HTML Document Structure Guide for Beginners

A web page must follow a clear structure so browsers can read and show it correctly. This guide helps you…

Previous Article

JavaScript Ninja Code for Beginners

Next Article

PHP array_diff: How it Works with Examples

Write a Comment

Leave a Comment

Your email address will not be published. Required fields are marked *


Subscribe to Get Updates

Get the latest updates on Coding, Database, and Algorithms straight to your inbox.
No spam. Unsubscribe anytime.