HTML <ins> Tag
<ins> tag represents inserted text in an HTML document.
<ins> tag can be handy when you need draw attention to text that has been inserted since a previous version of the document.
<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.
<ins> tag is written as
</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).
Or with some attributes, like this:
<ins cite="editinfo.htm" datetime="2014-08-24 00:00Z">Inserted text...</ins>
Basic Usage Example - A "To Do" List
<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
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.
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
Delete Table Row
Insert Table Row
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
Attributes can be added to an HTML element to provide more information about how the element should appear or behave.
There are 3 kinds of attributes that you can add to your HTML tags: Element-specific, global, and event handler content attributes.
<ins> element accepts the following attributes.
This table shows the attributes that are specific to the
|cite||Indicates a source that should indicate the reason for the change.|
|datetime||Date and time of change.|
The following attributes are standard across all HTML5 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 Handler Content Attributes
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.
Below are the standard HTML5 event handler content attributes.
Again, you can use any of these with the
<ins> element, as well as any other HTML5 element.
For a full explanation of these attributes, see HTML 5 event handler content attributes.
Differences Between HTML 4 & HTML 5
Here's a template for the
<ins> tag with all available attributes for the tag (based on HTML5). These are grouped into attribute types, each type separated by a space. In many cases, you will probably only need one or two (if any) attributes. Simply remove the attributes you don't need.
<ins cite="" datetime="" accesskey="" class="" contenteditable="" contextmenu="" dir="" draggable="" dropzone="" hidden="" id="" itemid="" itemprop="" itemref="" itemscope="" itemtype="" lang="" spellcheck="" style="" tabindex="" title="" translate="" onabort="" onautocomplete="" onautocompleteerror="" onblur="" oncancel="" oncanplay="" oncanplaythrough="" onchange="" onclick="" onclose="" oncontextmenu="" oncuechange="" ondblclick="" ondrag="" ondragend="" ondragenter="" ondragexit="" ondragleave="" ondragover="" ondragstart="" ondrop="" ondurationchange="" onemptied="" onended="" onerror="" onfocus="" oninput="" oninvalid="" onkeydown="" onkeypress="" onkeyup="" onload="" onloadeddata="" onloadedmetadata="" onloadstart="" onmousedown="" onmouseenter="" onmouseleave="" onmousemove="" onmouseout="" onmouseover="" onmouseup="" onmousewheel="" onpause="" onplay="" onplaying="" onprogress="" onratechange="" onreset="" onresize="" onscroll="" onseeked="" onseeking="" onselect="" onshow="" onsort="" onstalled="" onsubmit="" onsuspend="" ontimeupdate="" ontoggle="" onvolumechange="" onwaiting="" > </ins>
Here are the official specifications for the
- HTML5 Specification (W3C)
- HTML Living Standard (WHATWG)
- Current W3C Draft (the next version that is currently being worked on)
- HTML 4 (W3C)
What's the Difference?
W3C creates "snapshot" specifications that don't change once defined. So the HTML5 specification won't change once it becomes an official recommendation. WHATWG on the other hand, develops a "living standard" that is updated on a regular basis. In general, you will probably find that the HTML living standard will be more closely aligned to the current W3C draft than to the HTML5 specification.