HTML allows six different tags to place Headings in the documents. The heading elements start with the letter h followed by a number from 1 through 6 as – <h1>, <h2>, <h3>, … <h6>. All of these heading elements are closed tags and this means that the headings close with the heading number that you had initially started with. For example if you start a heading with <h1> you have to end the element with </h1> and similary if you start with <h6> you have to end with </h6>.
Syntax:
<h1 property=”value” property=”value” …> The actual Heading </h1>
Note: Though the above starts with h1, any of the heading elements can be put here and the same heading level should be used to close the heading element.
Valid Properties:
1. align This property is used to set the horizontal alignment of the heading with reference to the current margins. The possible value that can be used for this property is any one from – left, right, center or justify.
Apart from the above, the headings also have the common properties that can be set. Refer to the common properties page for an explanation of them.
Example:
<h1 align=”center” title=”Sample Heading 1″> This is the Heading number 1</h1>
Notes:
1. In most implementations, heading numbers correspond inversely with the 6 font sizes supported by the <font> element. While, <h1> corresponds to font size 6, <h6> corresponds to font size 1. The default font size on most web browsers is 3. However, in modern times, it is preferred to use the Style Sheets to set the font sizes and other presentational features.
2. The align property of the headings is only available in Transitional version of HTML. However, HTML 3.0 supports only the align property and HTML 2.0 does not support any attributes for the headings.
Filed under: Block Level Elements Tagged: | Education, HTML / XHTML, Learn HTML, Learn XHTML, Training, Web Site Development