Note: If you don't know what an element/tag is and/or how you must use it we recommend you read our HTML tags and attributes tutorial, which you can find in our HTML tutorials section.
Table of contents
Bypass table of contentsThe HTML h2 element contains a second level heading. Headings, serving as titles for pieces of text, help organize the information in the document to achieve a better understanding of the content. They must be a short and concise description of the content treated under them.
There are six levels of headings (h1 to h6) that allow authors to set titles and subtitles and rank the information in the document. Thanks to this, the headings of a document can be interpreted as its table of contents.
Browsers may render headings with font sizes greater than the used in regular text. The size usually depends on the heading level: it goes smaller when the heading level is lower.
Note that the "align" attribute for this element has been deprecated in HTML 4.01. Its use is no longer recommended.
In this example, we set up a document with a title ("The HTML h1 tag"), and a subtitle ("Examples") with two subtitles more ("Example 1" and "Example 2"). This anidation of content can go up to the sixth level.
The "id" attribute assigns an identifier to the associated element. This identifier must be unique in the document and can be used to refer to that element in other instances (e.g., from client-side scripts).
The "class" attribute assigns a class name (or a list of class names separated by spaces) to the container element. It is used together with style sheets and tells the browser the class (or classes) to which the element is associated.
A class gives presentational attributes to elements (read more at the Cascading Style Sheets tutorial).
This attribute is used to define presentational attributes for the containing element, and its value should be composed by style sheets properties. Although in some cases it can become useful, a better practice is to place presentational attributes in external files, relating them to elements with the "class" attribute. This way you keep the semantic and presentational parts of your document separated.
You can find more information about presentational attributes at the Cascading Style Sheets tutorial.
The purpose of this attribute is to provide a title for the element. Its value must be a short and accurate description of the element. Browsers usually render it as a "tool tip" when the user puts the mouse pointer over the element for a short period of time.
Specifies the language of an element's content. The default value is "unknown".
When writing XHTML 1.0 documents, the attribute used to specify the language of an elements is "xml:lang". For forward and backward compatibility both attributes can be used simultaneously as in the example below. Note, that in XHTML 1.1 the "lang" attribute has been completely replaced by "xml:lang" and its use is no longer valid.
This attribute indicates the direction in which the texts of the element must be read. This includes content, attribute values and tables. It has two possible values that are case-insensitive:
This attribute has been deprecated in HTML 4.01. Therefore its use is no longer recommended.
It defined the horizontal alignment of its content. Possible values (case-insensitive) are:
See a complete list and information about events in HTML
Diseño y desarrollo: Latitud29.com