Formatting in HTML

What is the formatting? 

Formatting means organize things for better presentation.

 Formatting tags in HTML


Sample Output for bold and strong

Bold <b> V/S Strong <strong>

<b> Bold Text</b>
<strong> Strong Text</strong>

Note:

  • Both generates the same result but are semantically different.
  • Strong is used to mark the important text.
Sample output of <i> and <em> tag

Italic <i> V/s Emphasize <em>

<i> Italic Text </i>
<em> Emphasized Text </em>








Sample output of <u> and <ins> tag

Underline <u> v/S Insert <ins>

<u> Underline Text </u>
<ins> Insert Text </ins>






Sample output for <strike> and <del> tag

<strike> V/S <del>

<strike> Strike through text</strike>
<del> Deleted text </del>






Sample output for <sup> and <sub> tag

Superscript V/S Subscript

5 <sup>2</sup>
H <sub>2</sub>O









Sample output of center tag

Center

<center>Center aligned text</center>




Font Tag

Sample output of font tag
<font  
    face = "arial"  
    color = "red"  
    size = "24px" >
      This is customized font text
</font>


Preformatted <pre> Tag

It is used to print the pre-formatted text.
Example-1: Sample output without pre-formatting

Example-1:

<p>
    This
        is
           my
              style.
</p>


Example-2: Sample output with pre-formatting tag

Example-2:

<p>
  <pre>
      This
         is
           my
             style
  </pre>
</p>

Break Row <Br> Tag

Sample output of <br> tag.
  1. By default, a line is changed when one line is completely filled, this is called word wrapping.
  2. Before ending the line if you want to change the line then <br> tag can be used.
  3. <br> is an empty tag so no need to close explicitly.
<p>
  First line <br>
  Second line 
</p>

Horizontal Ruler <hr> Tag

Generates an horizontal line.
Sample output of <hr> tag

<p>
      First line <hr>
      Second line
</p>








Watch the video for Formatting in HTML


Comments

Popular posts from this blog

Program to calculate telephone bill

Sum of two numbers in go lang

Program to check a year is leap year or not.

String in golang

Identifiers

Arrays in C Language

Reserved Words in Java

Data types in Java

Pointers in C Language

Literals in Java