Formatting Tags of HTML5

HTML5, Web Development / Sunday, July 29th, 2018

Formatting Tags

Text formatting, in other words presenting the text on an HTML page in a desired manner, is an important part of creating a web page so we have to learn the Formatting Tags of HTML5. Let us understand how we can lay out of text controls its appearance on a page. 


Headers are used to specify the headings of sections or sub-sections in a document. Depending on the desired size of the text, any of six available levels (<H1> to <H6>) of headers can be used. The following code shows the usage and varying size of the rendered text depending upon the tag used.

Header Tags
Rendering of the six header levels

There is neither predefined sequence for using the different levels of the header tags nor any restrictions on which one can be used. So the user has the option of using any level of header tag anywhere in the document. The size goes in decreasing order with the increasing order of the level  (i.e. From <H1> to <H6>).

Other Formatting Tags of HTML5

Let us now look at some more tags that can be used to format text. These are all given in the example shown below:

Formatting tags
Various formatting tags

1. BOLD: The text can be displayed in boldface by writing it in between the <B> and </B> tags.

2. ITALICS: It starts with <I> and ends with </I> tag. It is used to display the text in italics.

3. UNDERLINE: It is used for underlining the text to be displayed. The <U> tag is used for this purpose. These tags can be nested. So in order to see the text in boldface, in italics and underlined, it should be placed between the <B><I><U> and </U></I></B> tags. Note that the closing tags are written in reverse order, because any tag used within some other tag should be closed first.

4. PARAGRAPH: If you want to display the text in the form of paragraphs, then the <P> tag should be used.

5. TT: The <TT> tag is used for displaying text in a fixed width font similar to that of a typewriter.

6. STRIKE: If you want the text to be marked with a strikethrough character, place it within the <S> and </S> tags.

7. STRONG: There are certain text-based browsers that do not render the text as boldfaced. So you can use the <STRONG> tag instead of the <B> tag. This displays the text to stand out in the most appropriate manner for the browser.

8. EM: Just as the <STRONG> tag corresponds to the <B> tag, the <EM> can be used instead of the <I> tag. The reason for using it is the same as for the <STRONG> tag. The <EM> tag is used for emphasizing the text in the manner most appropriate to the browser.

9. BR: This tag is used for inserting a line break. The text written after the <BR> tag is displayed from the beginning of the next line onwards. This tag does not need a corresponding terminating tag.

10 HR: This tag puts a horizontal line on the page. It has the following attributes:

ALIGN: It is used for aligning the line on the page. The possible values of this attribute are LEFT, RIGHT, and  CENTER. It is useful when the width of the line is less than the width of the page.

NOSHADE: This attribute is used to prevent any shading effect.

SIZE: It is used for specifying the thickness of the line.

WIDTH: You can set the width of a line using this attribute. The value can be specified either in pixels or as a percentage of the width of the page, e.g., <HR WIDTH = “30%”>.

11. BLOCKQUOTE: This tag indents the left margin of the text. It is used for displaying the text as quoted text.

12. ADDRESS: This tag, as shown in Figure, displays the text in italics.

13. CITE: The text placed in between the <CITE> and </CITE> tags is rendered in italics by the browser.


This tag is used to present the text exactly as written in the code, including whitespace characters. It is terminated by a </PRE> tag.  Consider the example shown, to understand how this tag works.

PRE tag
Example of PRE tag

As shown in Figure, the format of the text presented in the browser remains the same as written in the code. If we do not use the <PRE> tag, the browser condenses the white space when presenting the text on the web page.

These are the Formatting Tags of HTML5.

Related Topic:


Leave a Reply

Your email address will not be published. Required fields are marked *