The HTML text elements are to display text information in an HTML page. Every text document (e.g., MS Word) have headings, subheadings, and text contents in the form of sentence, paragraphs.
HTML has the following headings and sub-headings where <h1> being the largest and <h6> being the smallest heading. The size and font type of each can be modified with CSS.
<h1> – Largest heading
<h6> – Smallest heading
The text contents are paragraphs with sentences and quotes. In HTML, following tags are used
<p> - for paragraph <blockquote> or <q> - for quote
Formatting Text Contents
HTML elements other than headings and paragraphs are used to format the text contents inside an HTML documents.
Acronyms and Abbreviations: The text content sometimes contains acronyms or abbreviations. It is short form of a longer name or title. The HTML uses two tags to display the full title of the abbreviation.
<acronym> …. <acronym>
<abbr> … </abbr>
Here are some examples of formatting text contents.
<acronym title=”United Nations Environment Programme”>UNEP</acronym> <abbr title=”United Nations Environment Programme”>UNEP</abbr>
Italic Text Contents
There are many HTML tags that shows text contents in italic, but their purpose are different. Here is a list of such HTML tags.
|<i>||Shows the text in italic.|
|<em>||Put emphasis to a text content|
|<dfn>||Definition of a term (the term in italic)|
|<address>||Address of the author in italic|
|<cite>||Shows a reference to a piece of work – a book, web page, journal or any text content.|
Here are examples of italicized text.
Italic text (<i>)
<p> This paragraph contains <i>Italic </i> word.</p>
This paragraph contains italic word.
<p>In this paragraph, a word is <em>important</em> so it is emphasized.</p>
In this paragraph, a word is important so it is emphasized.
<p> <dfn>Orange<dfn> is a citrus fruit.</p>
Orange is a citrus fruit.
<address> <p>First Name : John</p> <p>Last Name: Peterson</p> <p>City: London</p> <p>Street: 101, Baker street</p> <p>Phone: 111-3344<p> <p>Email: <a href=”mailto:[email protected]”> john</a></p> </address>
First Name : John
Last Name: Peterson
Street: 101, Baker street
<p> Mark Twain was an American writer. He wrote <cite>The Adventures of Tom Sawyer</cite> in 1876.</p>
Mark Twain was an American writer. He wrote The Adventures of Tom Sawyer in 1876.
Bold Text Contents
Some text contents are shown in bold to put more emphasis or to show importance of the text. The HTML tags used to do this are
|<b>||Show a text in bold.|
|<strong>||Bold a text to show strong importance.|
These are some examples of bold text content.
<p>This is a <b>bold text</b> content.</p>
This is a bold text content.
<p> This text has certain <strong>words</strong> that has strong importance.</p>
This text has certain words that has strong importance.
Superscript & Subscript
The superscript and the subscript are very important when you want to write a scientific or mathematical equation.
To write “A squared” which is A2 and “A subscript 2” is A2 use following tags
These are examples of subscripts and superscripts.
Computer Code Tag
There is a tag that can be used to show computer codes.
|<code>||To display computer codes|
The example below shows how to use <code> tag to display computer codes.
Computer Code (<code>)
<p>The following is computer code.</p> <code>#include “stdio.h”</code>
The following is computer code.
Inserting and Deleting text
We want to show that a text form the document is inserted or deleted. This is possible with two HTML tags given below.
|<ins>||Shows inserted text|
|<del>||Shows deleted text|
The examples of inserting and deleting text is given below.
<p> This text is inserted <ins>globe</ins>and it is underlined.</p>
This text is inserted- globe and it is underlined.
<p>The line has a word which is <del>removed </del> or deleted and it is strike out.</p>
The line has a word which is
removed or deleted and it is strike out.
Tags not supported in HTML 5
There are text related tags which are not supported in HTML 5 and you can use them on HTML elements from CSS (Cascading Style sheet)
|HTML Tag||HTML 4.01||HTML 5|
Note: There are other HTML standards and browsers for which these tags are used differently.