Formatting Tags
Posted in HTML Tutorials | Email This PostFormatting Text:
Text can be formatted using different styles, size, and color etc.
Text style:
Bold tag <b> </b>: it is used to display the text in bold letters.
Example:
<html> <head> <title> my first web page </title></head> <body> <b>html is hyper text markup language</b> </body> </html>
Output: hyper text markup language
Italic tag <i></i> : it is used to display the text in italic letters.
Example:
<html> <head> <title> my first web page </title></head> <body> <b><i>html is hyper text markup language</i></b> </body> </html>
Output: hyper text markup language
Underline tag <u></u>: it is used to underline the text.
Example:
<html> <head> <title> my first web page </title></head> <body> <u>html is hyper text markup language</u> </body> </html>
Output: hyper text markup language
Nested tags:
Example:
<html> <head> <title> my first web page </title></head> <body> <b><i>html is hyper text markup language</i></b> </body> </html>
in the above example we have a line of code
<b><i>html is hyper text markup language</i></b>in this we have nested italic tag with bold tag, such type of grouping is known as nested tags.care should be taken that tags should not overlap each other i.e. the inner tag should be closed before outer tag is closed.
<tt></tt>
Sometimes we need a font with the same width for all the alphabet, to instruct the browser to use a fixed width font with a text we use <tt></tt>.e.g.:width of alphabet w is more than alphabet i using <tt></tt> we can have the same width of i as equal to that of w.
<s>
This tag is used to strike a given line through the text.
output:this tag is used to strike a given line through the text.
<big>
This tag is used to display the text in large font.
output: hyper text markup language.
<small>
This tag is used to display the text in small font.
output: hyper text markup language.
<sub>
This tag is used to subscript the text
Example:
<html> <head> <title>chemical lab </title></head> <body> chemical formula for water is<br> H<sub>2</sub>O </p> </body> </html>
Output: chemical formula for water
H2O.
<sup>
This tag is used to superscript the text.
Example:
<html> <head> <title>birthday reminder </title></head> <body> today is 30<sup>th</sup> of april , its neha’s birthday. </body> </html>
Output:
today is 30thapril , its neha’s birthday.
a sample code using all formatting tags.
<html> <head> <title>sample</title></head> <body> <b>HTML is Hyper Text Markup Language</b><br>< !-- this is an example of bold tag--> <hr/> <b><i>HTML is Hyper Text Markup Language</i></b><br>< !-- this is an example of italic tag--> <hr/> <u>HTML is Hyper Text Markup Language</u><br>< !-- this is an example of underline tag--> <hr/> <p>Chemical Formula for Water is H<sub>2</sub>O<br>< !-- this is an example of subscript tag --> <hr/> Today is 30<sup>th</sup> of April , its Neha’s Birthday.<br> <hr/> This is an example of <s> Strike tag </s><br><!-- this is an example of strike tag--> <hr/> this is an example of <small><b>small tag</b></small><br>< !-- this is an example of small tag--> <hr/> this is an example of <big><b> big tag</b> </big><br>< !-- this is an example of big tag--> <hr/> </body> </html>
Output
it is easy to learn html.