hn Tag for Headings

hn Tag for Headings

Documents have headings like in magazines, newspapers to explain the purpose of the article and headings can also structure a document as in table of contents of a book. Different sizes of headings are used in documents similarly, HTML and XHTML have six levels of headings as, <h1> , <h2> , <h3> , <h4> , <h5> and <h6> elements and where the <h1> element is largest of all, followed by <h2> and <h6> being the smallest as shown

HTML code

<h1> This is H1 </h1>
<h2> This is H2 </h2>
<h3> This is H3 </h3>
<h4> This is H4 </h4>
<h5> This is H5 </h5>
<h6> This is H6 </h6>

Browser output

The hn Tag for Headings

Usually <h1>, <h2> and <h3> are larger than the default text size in web page, <h4> is same size as of the text and <h5> and <h6> are smaller than the default text size if not changed by CSS. While displaying any heading, browser adds one line before and after that heading. Heading element has following attributes

align class id style title dir lang xml:lang

Align attribute was in old HTML version to give alignment of heading (left, right or center)

Share this post
[social_warfare]
Text Formatting
br-Tag for Line Breaks

Get industry recognized certification – Contact us

keyboard_arrow_up