Html Text Formatting

Html Text Formatting tags can make some text on your web pages to appear differently than normal text content.

  • There are several tags to format the text.
  • It has many style to the text are Bold, Italics, Strong, Emphasized, Big, Small, Subscript, Superscript, Preformatted text.
  • Each text style should be enclose with the required tag.
  • We can also set Font type, Size and Color to the text in the body tag.

HTML Text Formatting Elements

The h1 to h6 Elements

The <h1> to <h6> elements are used for document headings. A heading can be a title for a page, paragraph, chapter, etc. The <h1> element define the main heading(s) of the document. The <h2> element defines a heading smaller than <h1> etc. The <h6> element can be used as the least important heading.Heading elements are typically displayed in a larger font than the rest of the text in the HTML document.

The p Element

The <p> element marks a paragraph of text in the HTML document. A paragraph contains multiple sentences that are related to each other. Two paragraphs following each other will be displayed with space in between to mark the different paragraphs.

The br Element

The <br> element can be used to force an automatic single line break e.g. in between two paragraphs, or after a line within a paragraph. The <br> element do not need an end tag, because it is an empty element.

The hr Element

The <hr> element creates a horizontal ruler, which can be used to separate different vertical sections of your webpage. Two paragraphs following each other with a <hr> element in between will have a horizontal line displayed in between them.

The b Element

The <b> element marks text to be displayed as bold.

The i Element

The <i> elements marks text to be displayed as italic.

The strong Element

The <strong> element is used to mark text to be displayed strong. In practice the effect is similar to the <b> element, although browsers may differentiate between the effect of the two elements.

The big Element

The <big> element is used to marks text to be displayed as bigger than the default text size.

The em Element

The <em> element marks text to be displayed as emphasized. In practice the effect is similar to that of the <i> element, although browsers may differentiate between the effect of the two elements.

The code Element

The <code> element is used to markup blocks of text to be displayed using a monosize font, like Courier. The <code> element is typically used to display programming code.

The sub Element

The <sub> element marks text to be displayed in smaller characters (subscript).

The sup Element

The <sup> element marks text to be displayed in smaller characters, but lifted up from the text base line.

The del Element

The <del> element marks text as deleted, meaning it will be displayed with a line through it.

The pre Element

The pre element formats the text with a mono space font like the code element does, but the pre element shows the line breaks you write inside it. Normally line breaks are ignored, or shown as a space.

The samp Element

HTML contains several elements that are used to format the text in the HTML page. For instance, elements exists to markup headlines, paragraphs, bold, italic, underlined text etc. This text looks at these HTML elements.


Today, much of the visual styling of HTML text elements is done via CSS. But, you still use the HTML elements to mark the structure of the text elements. For instance, to mark paragraphs, headlines etc.

HTML Text Formatting Tags

Tag Description
<b> Defines bold text.
<del> Defines deleted text.
<em> Defines emphasized text.
<i> Defines italic text.
<ins> Defines inserted text.
<mark> Defines marked/highlighted text.
<small> Defines small text.
<strong> Defines strong text.
<sub> Defines subscripted text.
<sup> Defines superscripted text.

HTML Citations, Quotations, and Definition Tags

Tag Description
<abbr> Defines an abbreviation.
<address> Defines contact information for the author/owner of a document.
<bdo> Defines the text direction.
<blockquote> Defines a long quotation.
<q> Defines a short quotation.
<cite> Defines a citation.
<dfn> Defines a definition term.

HTML Computer Output Tags

Tag Description
<code> Defines computer code text.
<kbd> Defines keyboard text.
<samp> Defines sample computer code.
<var> Defines a variable.
<pre> Defines preformatted text.

Code for Text Formatting in html:

Html Text Formatting
Html Text Formatting Code


Output for Text Formatting in html:

Html Text Formatting
Html Text Formatting Output


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.