HTML defines six levels of heading. A Heading element implies all the font changes, paragraph breaks before and after, and white space necessary to render the heading.
The highest level of headings is <H1>
, followed by <H2>
... <H6>
.
Example of use:
<H1>This is a first level heading heading</H1>
Here is some normal paragraph text
<H2>This is a second level heading</H2>
Here is some more normal paragraph text.
The rendering of headings is determined by the HTML user agent, but typical renderings are:
Although heading levels can be skipped (for example, from H1
to H3
), this practice is not recommended as skipping heading levels may produce unpredictable results when generating other representations from HTML. For example, much talked about automatic contents/index generation scripts could use heading settings to generate contents 'trees' where <H2>
would be considered to label the start of a section that is a sub-section of a section denoted by a <H1>
element and so on.
Included since the HTML 3.2 specification is the ability to align Headings. The ALIGN="left|center|right" attribute was been added to the <H1>
through to <H6>
elements. e.g:
<H1 ALIGN=center>This is a centred heading</H1>
would align a heading of style 1 in the centre of the page.
Internet Explorer (4.0 and above) also support the use of the TITLE attribute. This can be used for informational purposes, with Internet Explorer treating the value of the TITLE
attribute as a 'ToolTip' which is displayed when the reader passes their mouse over the contents of the <Hx>
element. For example, adding :
. . .TITLE="A centered heading"
to the above example, the section displays as :
NOTE : Currently, Internet Explorer doesn't show the ToolTip for the <Hx>
elements.
LANG="language setting"
The LANG
attribute can be used to specify what language the <Hx>
element is using. It accepts any valid ISO standard language abbreviation (for example "en"
for English, "de"
for German etc.) For more details, see the Document Localisation section for more details.
LANGUAGE="Scripting language"
The LANGUAGE
attribute can be used to expressly specify which scripting language Internet Explorer 4.0 uses to interpret any scripting information used in the <Hx>
element. It can accept values of vbscript
, vbs
, javascript
or jscript
. The first two specify the scripting language as Visual Basic Script, the latter two specify it as using Javascript (the default scripting language used if no LANGUAGE
attribute is set.
CLASS="Style Sheet class name"
The CLASS
attribute is used to specify the <Hx>
as using a particular style sheet class. For example, a style sheet class defined as:
<STYLE TYPE="text/css">
.Gold {color : gold}
</STYLE>
could then be referenced as:
<H1 CLASS="gold">A gold heading</H1>
and would be displayed in red. See the Style Sheets overview for more information and style sheet settings.
STYLE="In line style setting"
As well as using previously defined style sheet settings, the <Hx>
elements can have in-line stylings attached to it. For example:
<H3 STYLE="{color : gold}">A small gold heading</H3>
would display in the same colour as the above example. See the Style Sheets section for more details about style sheet settings.
ID="Unique element identifier"
The ID
attribute can be used to either reference a unique style sheet identifier, or to provide a unique name for the <Hx>
element for scripting purposes. Any <Hx>
element with an ID
attribute can be directly manipulated in script by referencing its ID
attribute, rather than working through the All collection to determine the element. See the Scripting introduction topic for more information.
Every <Hx>
element in a document is an object that can be manipulated through scripting. Note that scripting of the <Hx>
element/object is only supported by Internet Explorer 4.0 in its Dynamic HTML object model. Netscape does not support direct scripting of the <Hx>
element at all.
<Hx...>
Properties
As well as supporting all of the standard Dynamic HTML properties (i.e. className, document, id, innerHTML, innerText, isTextEdit, lang, language, offsetHeight, offsetLeft, offsetParent, offsetTop, offsetWidth, outerHTML, outerText, parentElement, parentTextEdit, sourceIndex, style, tagName and title), the Hx
elements also support the extra align property, which reflects any ALIGN
attribute settings for the heading. Details of the standard properties can be found in the standard Dynamic HTML properties topics.
<Hx...>
Methods
The <Hx...>
element/object supports all of the standard Dynamic HTML methods (i.e. click, contains, getAttribute, insertAdjacentHTML, insertAdjacentText, removeAttribute, scrollIntoView and setAttribute). Details of these can be found in the standard Dynamic HTML Methods topics.
<Hx...>
Events
The <Hx...>
element/object supports all of the standard Dynamic HTML events (i.e. onclick, ondblclick, ondragstart, onfilterchange, onhelp, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup and onselectstart). Details of these can be found in the standard Dynamic HTML events topics.
© 1995-1998, Stephen Le Hunte
file: /Techref/language/html/ib/Block_Level_Elements/heading.htm, 10KB, , updated: 2004/3/1 16:47, local time: 2024/8/14 14:12,
18.219.91.251:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://sxlist.com/techref/language/html/ib/Block_Level_Elements/heading.htm"> <Hx></A> |
Did you find what you needed? |
Welcome to sxlist.com!sales, advertizing, & kind contributors just like you! Please don't rip/copy (here's why Copies of the site on CD are available at minimal cost. |
Welcome to sxlist.com! |
.