HTML Tag Reference - HTML tag <h1-<h6>








<h1> creates the level 1 header. <h2> creates the level 2 header, etc.

Browser compatibility

<h1> - <h6> Yes Yes Yes Yes Yes

What's new in HTML5

The "align" attribute is deprecated in HTML5. Use CSS to instead.

Attribute

align
Value:left|center|right|justify
Not supported in HTML5. the alignment of a heading

Global Attributes

The <h1>-<h6> tag supports the Global Attributes in HTML.





Event Attributes

The <h1>-<h6> tag supports the Event Attributes in HTML.

Default CSS Settings

h1 {
    display: block;
    font-size: 2em;
    margin-before: 0.67em;
    margin-after: 0.67em;
    margin-start: 0;
    margin-end: 0;
    font-weight: bold; 
}




Example

A demo showing how to use <h1> <h2> <h3> <h4> <h5> <h6>.

<html>
<body>
     <h1>This is a #1 heading</h1>
     <h2>This is a #2 heading</h2>
     <h3>This is a #3 heading</h3>
     <h4>This is a #4 heading</h4>
     <h5>This is a #5 heading</h5>
     <h6>This is a #6 heading</h6>
</body><!--from   w  w w  . j a  va 2 s  . c o m-->
</html>

Click to view the demo