HTML <ins> Tag

The HTML <ins> tag represents inserted text in an HTML document.

The <ins> tag can be handy when you need draw attention to text that has been inserted since a previous version of the document.

The <ins> tag is sometimes used along with the <del> tag for markup of deleted text.

Browsers usually underline inserted text and strike a line through deleted text. However, as with any HTML element, you can apply your own styles to the <ins> element using CSS.

Syntax

The <ins> tag is written as <ins></ins> with the inserted text enclosed between the start and end tags. You can use attributes such as cite (to link to the source of the quotation or more information about the edit) and datetime (to specify the date and/or time of the edit).

Like this:

Or with some attributes, like this:

Examples

Basic Usage Example - A "To Do" List

The <ins> tag can be used in a "to do" list to markup items that have been added to the list. In this example, I've also used the <del> tag to indicate that the first item has been done.

Date & Time

The datetime attribute allows you to add a date and (optionally) a time. This attribute is mainly intended for private use (e.g. by server-side scripts collecting statistics about a site's edits), but it could potentially be displayed to users.

Here, we can add date and time information to the <ins> tag and the <del> tag to indicate items that have been added.

Citations

You can add a citation using the cite attribute. The value of this attribute must be the URL of a document that explains the change. This attribute is not intended for readers of the document. Rather, it is intended for private use (e.g. by server-side scripts collecting statistics about a site's edits).

Inserting Table Rows &/or Columns

To insert a table row or column, you need to apply the <ins> tag to the content within those rows/columns. You can't simply enclose a <tr> tag or <td> tag within <ins> tags.

The following examples demonstrate inserting table columns and table rows. You can also add styles using CSS if needed. Here, I've applied the CSS background-color property to the <ins> element.

Delete Table Row

Insert Table Row

Remove Underline

Most browsers apply an underline to the <ins> element. While this can be useful, it can also potentially confuse your users, as they might mistaken the inserted text for a hyperlink and try clicking on it.

You can always use the CSS text-decoration property to remove the underline and style your <ins> elements in another way. In this example, we remove the underline and apply a background-color to the <ins> element.

Attributes

Attributes can be added to an HTML element to provide more information about how the element should appear or behave.

The <ins> element accepts the following attributes.

AttributeDescription
citeIndicates a source that should indicate the reason for the change.
datetimeDate and time of change.

Global Attributes

The following attributes are standard across all HTML elements. Therefore, you can use these attributes with the <ins> tag , as well as with all other HTML tags.

For a full explanation of these attributes, see HTML 5 global attributes.

Event Handlers

Event handler content attributes enable you to invoke a script from within your HTML. The script is invoked when a certain "event" occurs. Each event handler content attribute deals with a different event.

Most event handler content attributes can be used on all HTML elements, but some event handlers have specific rules around when they can be used and which elements they are applicable to.

For more detail, see HTML event handler content attributes.