Skip to content
Related Articles

Related Articles

Improve Article

HTML Text Formatting Elements

  • Last Updated : 15 Sep, 2021
Geek Week

As we know, HTML provides many predefined elements that are used to change the formatting of text. The formatting can be used to set the text styles (like – bold, italic, or emphasized, etc.), highlighting the text, making text superscript and subscript, etc.

Text Formatting Elements:

<b> and <strong> Tags: Both tags are used to make a text bold. The text content of tag is shown as important information in the webpage.

Example: 

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>Bold and strong</title>
</head>
  
<body>
    <!--Normal text-->
    <p>Normal Text</p>
  
    <!--Text in Bold-->
    <p><b>Bold Text</b></p>
  
    <!--Text in Strong-->
    <p><strong> Strong Text</strong></p>
</body>
  
</html>


 



Output:

HTML <i> and <em> Tags: Both tags are used to make the text italic and emphasized. Both the element have an opening and closing tags.

Example:

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>Italic and emphasized</title>
</head>
  
<body>
    <!--Normal text-->
    <p>Normal Text</p>
  
    <!--Text in Italics-->
    <p><i>The Text inside italic Tag</i></p>
  
    <!--Text in Emphasize-->
    <p><em>Emphasized Text</em></p>
</body>
  
</html>

Output: 

HTML <small> and <big> Tags: The <small> tag is used to set small font-size where as <big> tag is used to set big font-size.

 



Example: 

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>Small and Big</title>
</head>
  
<body>
    <!--Text in Normal-->
    <p>Normal text</p>
  
    <small>The text inside small Tag</small>
  
    <p>
        <big>The text inside big Tag</big>
    </p>
</body>
  
</html>

Output: 

HTML <sup> and <sub> Tags: The <sup> tag is used to superscript a text where as <sub> tag is used to subscript a text.

Example: 

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>Superscript and Subscript</title>
</head>
  
<body>
  
    <!--Text in Normal-->
    <p>Normal Text
      
    <!--Text in Superscript-->
    <p>
        <sup>superscript </sup> Text
    </p>
  
    <!--Text in Subscript-->
    <p>
        <sub>subscript</sub>Text
    </p>
</body>
  
</html>

Output:

HTML <ins> and <del> Tag: The <ins> tag is used to underline a text marking the part as inserted or added. It also has an opening and a closing tag. This tag is mainly used in a text in place of deleted text whereas <del> tag is used to delete the text it adds a strike line on the text.

Example:

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>Inserting and deleting</title>
</head>
  
<body>
    <!--Deleting andText in Insert-->
    <b>
        <p>The TajMahal is located in 
            <del>Bombay</del>
            <ins>Agra</ins>
        </p>
    </b>
</body>
  
</html>

Output:

HTML <mark> Tag: The <mark> tag is used to highlighting a text. It has an opening and closing tag.

Example: 

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>Highlight</title>
</head>
  
<body>
  
    <!--Text in Normal-->
    <p>Normal Text</p>
  
    <!--Text in Highlight-->
    <p>
        <mark>Highlighted Text</mark>
    </p>
</body>
  
</html>

Output:

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.




My Personal Notes arrow_drop_up
Recommended Articles
Page :