Friday, December 5, 2014

How to use heading tags in HTML

Use of headings 


We can use heading tag to indicate our text as a heading.
There are six type of headings.
<H1>Your Text</H1>
<H2>Your Text</H2>
<H3>Your Text</H3>
<H4>Your Text</H4>
<H5>Your Text</H5>
<H6>Your Text</H6>
Example:
<HTML>
<HEAD><TITLE>Headings</TITLE></HEAD>
<BODY>
<H1>First level heading</H1>
<H2>Second level heading</H2>
<H3>Third level heading</H3>
<H4>Fourth level heading</H4>
<H5>Fifth level heading</H5>
<H6>Sixth level heading</H6>
</BODY>
</HTML>
Save this as headings.html in mysite folder

Output will be,

We can align headings to center, left or right. To align ,
<H1 align=”Center”>First heading</H1>

This will align the text “First heading” to center screen of your web browser.

How to use text formatting in HTML

Formatting a text


For text formatting there are some special tags.


For bold a text


We can use <B>--</B> or <STRONG>--</STRONG>

Here <B> stands for “bold”
For italic a text


We can use <I>--</I> or <EM>--</EM> or <DFN>--</DFN>
Here <I> Stands for “italic”, <EM> stands for “emphasis” and <DFN> stands for “definition”


For superscript a text
We Can use <SUP>--</SUP> for super scripting.
<SUP> stands for “superscript”


For subscript a text


We Can use <SUB>--</SUB> for sub scripting.
<SUB> stands for “subscript”


For delete a text


We Can use <DEL>--</DEL> for delete a text with a single strike.
<DEL> stands for “delete”


For block quote a text



We Can use <BLOCKQUOTE>--</BLOCKQUOTE> for indent a text from left margin to right.

For highlight a text


We Can use <MARK>--</MARK> for highlight a text.


For underline a text


We Can use <U>--</U> for underline a text.
<U> stands for “underline”


To use addresses



We Can use <ADDRESS>--</ADDRESS>  

Example:
<HTML>
<HEAD><TITLE>Text Formatting</TITLE></HEAD>
<BODY>
<B>This is bold tag</B><BR>
<I>This is italic tag</I><BR>
<EM>This tag is also use to italic a text</EM><BR>
<DFN>Definition tag normally in italic </DFN><BR>
I'm the 1<SUP>st</SUP>
<P>Water is known as H<SUB>2</SUB>o.</P>
<P>This is my <DEL>first</DEL> HTML document</P>
<BLOCKQUOTE>This text is away from left margin</BLOCKQUOTE>
<MARK> I want to highlight this sentence</MARK><BR>

<U>IS this underlined.</U>
<P>contact us @<ADDRESS>Main Road,Red light district.</ADDRESS></p>
</BODY>
</HTML>



Save this as “text formatting.html”.
Open it through your web browser.