HTML Text Formatting
Often you would have seen that the important text is either bold or italic. This is done to gather the visitor's attention.Emphasizing text is very common in webpages.Now in this tutorial you will learn about HTML Tags used to format text.
This text is bold.
This text is italic.
This issuperscript and this is subcript.
Text Formats In HTML
The text on a web page can be formatted in various ways, most common being bold or italic.But HTML offers a variety of tags.Given below is a list of tags and their details.
| Tag | Detail |
<u> |
Defines underlined text |
< code> |
Defines computer code text | <sup> |
Defines superscripted text |
<b> |
Defines bold text |
<strong> |
Defines Strong text | <del> |
Defines deleted text |
HTML Formatting Tags Examples
To make a text bold,underlined you just need to write the text between the corresponding tag.Here is a an example
<b>Text is bold</b>
<i>Text is italic</i>
Text is<sup>superscript</sup>
Text is <sub>subscript</sub>
<u>Text is underlined</u>
<big>Text is Big</big>
Result in browser is displayed as:
Text is bold
Text is italic
Text issuperscript
Text is subscript
Text is underlined
Text is Big
<b>Text is bold</b> <i>Text is italic</i> Text is<sup>superscript</sup> Text is <sub>subscript</sub> <u>Text is underlined</u> <big>Text is Big</big>
HTML <pre> Tag
You must have observed while creating webpages that the browser ignores the empty spaces and line breaks in the document.But in cases such as in a computer we want to display the text according to our layout,so we use < pre> tag.
<html>
<pre>
This is pre tag.
The empty spaces and line breaks are
preserved.
<big>Best used in computer codes.</big>
if(a>=5)
{
if(a%5==0)
printf("Divisble by 5");
else
printf("Not divisble by 5");
}
</pre>
</html>
<html>
<pre>
This is pre tag.
The empty spaces and line breaks are
preserved.
<big>Best used in computer codes.</big>
if(a>=5)
{
if(a%5==0)
printf("Divisble by 5");
else
printf("Not divisble by 5");
}
</pre>
</html>The result of the above is:
This is pre tag.
The empty spaces and line breaks are
preserved.
Best used in computer codes.
if(a>=5)
{
if(a%5==0)
printf("Divisble by 5");
else
printf("Not divisble by 5");
}
Previous:HTML Email links Next:HTML Reset Button
