HTML - <ins> Tag



The HTML <ins> tag represents a range of text that has been inserted into an HTML document. This inserted text is rendered as underlined text by the web browsers, although this property may be changed using the CSS text-decoration property.

The <ins> tag can be used with the <del> tag. The <del> tag indicates the text that has been deleted and the <ins> tag represents the text that has been inserted into the page.

Following is the attributes of the <ins> tag –

  • cite − This attribute defines the URL of a resource that explains the change.
  • datetime − It is used to specify the date and time of the inserted text. The datetime is inserted in the format yyyy-mm-ddThh:mm:ssZ.

Syntax

Following is the syntax of <ins> tag −

<ins> .... </ins>

Example

In the following example lets, see the usage of the <ins> tag along with <del> tag, as follows −

<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="utf-8">
</head>
<body>
   <h1>Tutorialspoint</h1>
   <h2>HTML ins element</h2>
   <p>tutorialspoint is a <del>physic classes</del>
      <ins>EdTech company</ins> that provides more than 6000 courses and tutorials
   </p>
</body>
</html>

When we run the above code, it will generate an output consisting of the text displayed on the webpage.

Example

Considering the following example, we are creating an HTML document and using the <ins> tag with the <del> tag. We are also using the CSS properties to style the content of the ins and del tags as follows −

<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="utf-8">
</head>
   <style>
   del {
      background-color: #fbb;
      color: #555;
   }

   ins {
      background-color: #d4fcbc;
   }
   </style>
</head>
<body>
   <p>There is <del>nothing</del>
      <ins>no code</ins> either good or bad, but <del>thinking</del>
      <ins>running it</ins> makes it so.
   </p>
   <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, <del>when an unknown printer took a galley of type and scrambled it to make a type specimen book</del>. </p>
</body>
</html>

On running the above code, the output window will pop up displaying the text along with a CSS properties applie to it on the webapge.

Example

Let's look at the following example, we are creating an HTML document and using the <ins> tag along with the attribute "datetime", as follows −

<!DOCTYPE html>
<html>
<head>
   <style>
      del {
         color: red;
      }

      ins {
         color: green;
      }
   </style>
</head>
<body>
   <h1>tutorialspoint</h1>
   <h2>HTML ins Tag</h2>
   <p> tutorialspoint is a <del>physics classes</del>
      <ins datetime="2023-06-14T13:50:03Z"> EdTech company</ins> that provides more than 6000 courses and tutorials
   </p>
</body>
</html>

When we run the above code, it will generate an output consisting of the text displayed on the webpage.

Example

Following is the example, where we are going to create an HTML document and using the <ins> tag along with the attribute "cite" & "datetime", as follows −

<!DOCTYPE html>
<html>
<head>
   <style>
      del,
      ins {
         display: block;
         text-decoration: none;
         position: relative;
      }

      del {
      background-color: #fbb;
      }

      ins {
         background-color: #d4fcbc;
      }

      del::before,
      ins::before {
         position: absolute;
         left: 0.5rem;
         font-family: monospace;
      }

      del::before {
         content: '−';
      }

      ins::before {
         content: '+';
      }

      p {
         margin: 0 1.8rem 0;
         font-family: Georgia, serif;
         font-size: 1rem;
      }
   </style>
</head>
<body>
   <p>"You're late!"</p>
   <del>
      <p>"I apologize for the delay."</p>
   </del>
   <ins cite="../howtobeawizard.html" datetime="2023-06">
      <p>"A wizard is never late …"</p>
   </ins>
</body>
</html>

On running the above code, the output window will pop up displaying the text on the webpage.

html_tags_reference.htm
Advertisements