How to define a text that has been deleted from the document in HTML5?


In HTML5, deleted content can be marked up using the <del> element. The <del> element is used to signify content that has been deleted from a document. When used, the content enclosed within the <del> element will be displayed with a strikethrough style. This can be helpful for showing changes made to a document or indicating that certain information is no longer accurate. Additionally, the <del> element can be used in conjunction with the <ins> element to indicate changes that have been made to a document, with the <ins> element used to mark up inserted text.

Approaches

In HTML5, there are several methods for defining deleted content, including −

  • Using the `<Del>` Tag

  • The <s> or <strike> tag

  • The <mark> tag

Let us look at each approach in detail with examples now.

Approach 1: Using the `<Del>` Tag

The first approach to define a text that has been deleted from the document in HTML5 is by using the <Del> Tag. Text from the initial content that has been deleted or removed is marked up using this tag. It is frequently used to indicate changes made to a document, such as when editing a web page or when reviewing a document.

Example 

Here, we will go through a example to implement this approach −

<!DOCTYPE html>
<html>
<head>
   <title>Deleted Text Example</title>
</head>
<body>
   <h1>Deleted Text Example</h1>
   <p>This is some text that has been <del> deleted</del> from the document.</p>
</body>
</html>

Approach 2: The <s> or <strike> Tag

The second approach to define a text that has been deleted from the document in HTML5 is by using the <s> or <strike> Tag. When deleting text from a document, these tags are used to strike through the removed text. They are less frequently used than the del> element, but they have their uses.

Example 

Here, we will go through a example to implement this approach −

<!DOCTYPE html>
<html>
<head>
   <title>Deleted Text Example</title>
</head>
<body>
   <h1>Deleted Text Example</h1>
   <p>This is some text that has been <s>deleted</s> from the document.</p>
</body>
</html>

Approach 3: The <mark> Tag

The third approach to define a text that has been deleted from the document in HTML5 is by using the <mark> Tag. This tag is used to draw attention to deleted content from a document. It is helpful for drawing attention to edits made to a text.

Example 

Here, we will go through a example to implement this approach −

<!DOCTYPE html>
<html>
<head>
   <title>Deleted Text Example</title>
</head>
<body>
   <h1>Deleted Text Example</h1>
   <p>This is some text that has been <mark>deleted</mark> from the document.</p>
</body>
</html>

Conclusion

In HTML5, there are several methods for defining deleted content. The most popular method for marking up text that has been deleted or removed from the original material is the tag. The removed text can also be highlighted using the tag, while it can also be struck through using the and tags.

In order to properly define deleted text in HTML5, it's crucial to take the context and target population into account. Reader comprehension of the content can be improved, as well as the integrity of the document, by providing clear and concise information about modifications made to it.

Updated on: 27-Mar-2023

116 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements