Text Elements in HTML – Part 5
Foreword: In this part of the series I talk about the ins and del elements.
By: Chrysanthus Date Published: 31 May 2015
This is a double tag element. Imagine that you wrote and published a web page and the page has been out there for six months. Now, you want to insert some text or paragraph, and you want the readers to know that the text or paragraph has been inserted. To achieve this you have to use the ins element. If it is a short piece of text, it goes into the ins element. If it is a paragraph, the paragraph still goes into the ins element. The following code illustrates the use of the ins element for a short piece of text:
Pears are tasty.
So are apples.
I tried the code in my computer, and my browser underlined the inserted text to show that it is something that has been inserted. The following code shows a paragraph that has been inserted:
<p>some text . . .</p>
<p> I like fruit. </p>
<p>some text . . .</p>
I tried the code and my browser underlined the whole inserted paragraph.
This is a double tag element. Imagine that you had published a web page. Now you have decided to delete some texts from the page. However, you want the readers to still see the texts but know that they have been deleted. You use the del element for this. The following code illustrates this for a “to do” list:
<li>Empty the basin</li>
<li><del>Watch John's lectures</del></li>
<li><del>Download more tracks</del></li>
<li>Buy a monitor</li>
I tried the code and my browser cancelled (drew a line across) the del texts. Cancellation also takes place in my browser for the s element.
Attributes common to ins and del elements
The attributes common to the ins and del elements are the cite and the datetime attributes. The cite attribute may be used to specify the URL of a document that explains the change. This does not change the ins element into a hyperlink. However, the value can be read by some software or DOM. The datetime value is the date and optionally the time the change was made. The value of datetime has to be in machine-readable format – see later.
Note: you can have an ins element that is not inside a paragraph, but avoid that.
That is it for this part of the series. We stop here and continue in the next part.
Related LinksBasics of HTML 5
Basics of ECMAScript
HTML DOM Basics
Text Elements in HTML
Microsyntax Dates and Times in HTML
Common Idioms without Dedicated Elements
HTML Embedded Content
HTML Insecurities and Prevention
Presentation Mathematical Markup Language
More Related Links
PurePerl MySQL API
Major in Website Design
Perl Course - Optimized
Web Development Course