How to delete text from document using HTML ?

In this article, we delete text from an HTML document by using the <del> tag in the document. This tag stands for delete and is used to mark a portion of text which has been deleted from the document.

Syntax:

<del> Contents... </del>

Example: In the following example, deletion of a text from a document is demonstrated.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <title>
        How to delete text from a 
        document using HTML?
    </title>
  
    <style>
        del {
            color: red;
        }
  
        ins {
            color: green;
        }
  
        h1 {
            color: green;
        }
  
        body {
            text-align: center;
        }
    </style>
</head>
  
<body>
    <h1>GeeksforGeeks</h1>
  
    <b>
        HTML5 | How to delete 
        text from a document 
    </b>
  
    <p>
        GeeksforGeeks is a 
        <del>mathematical</del>
        <ins>computer</ins
        science portal
    </p>
</body>
  
</html>

chevron_right


Output:

Supported Browsers:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari

full-stack-img




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.