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>
<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
face = "arial"
color = "red"
size = "24px" >
This is customized font text
</font>
Preformatted <pre> Tag
This is customized font text
</font>
It is used to print the pre-formatted text.
Example-1: Sample output without pre-formatting |
Example-1:
<p>
This
is
my
style.
</p>
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. |
- By default, a line is changed when one line is completely filled, this is called word wrapping.
- Before ending the line if you want to change the line then <br> tag can be used.
- <br> is an empty tag so no need to close explicitly.
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>
Comments