Broad Network


HTML Edits

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

Introduction

This is part 5 of my series, Text Elements in HTML. In this part of the series I talk about the ins and del elements. The ins element is to mark inserted text. The del element is to mark a text as deleted. You should have read the previous parts of the series before reaching here, as this is a continuation.

ins
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:

<p>
  Pears are tasty.
<ins>
  So are apples.
</ins>
</p>

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:

<section>
<p>some text . . .</p>
<ins>
  <p> I like fruit. </p>
</ins>
<p>some text . . .</p>
</section>

I tried the code and my browser underlined the whole inserted paragraph.

del
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:

<h1>To Do</h1>
<ul>
<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>
</ul>

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.

Chrys

Related Links

Basics of HTML 5
Basics of ECMAScript
HTML DOM Basics
CSS Basics
Text Elements in HTML
Grouping Content
Microsyntax Dates and Times in HTML
Sectioning Content
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

BACK NEXT

Comments

Become the Writer's Fan
Send the Writer a Message