# 8. XHTML Structural Module

Contents

This section is normative.

This module defines all of the basic text container elements, attributes, and their content models that are structural in nature.

Element | Attributes | Content Model
--- | --- | ---
address | Common | ( Text)*
blockcode | Common | ( Text | Heading | Structural | List)*
blockquote | Common | ( Text | Heading | Structural | List)*
div | Common | ( Flow)*
h | Common | ( Text)*
p | Common | ( Text | List | blockcode | blockquote | pre | table )*
pre | Common | ( Text)*
section | Common | ( Flow)*
separator | Common | EMPTY

The content model for this module defines some content sets:

Heading
  h | h1 | h2 | h3 | h4 | h5 | h6
Structural
  action | address | blockcode | blockquote | div | List | listener | p | pre | script | section | separator | style | table
Flow
  Heading | Structural | Text

Implementations: RELAX NG, XML Schema

## 8.1. The address element

The address element may be used by authors to supply contact information for a document or a major part of a document such as a form.

Attributes

The Common collection
  A collection of other attribute collections, including: Bi-directional, Core, Edit, Embedding, Events, Forms, Hypertext, I18N, Map, Metainformation, and Role

Example

    <address href="mailto:webmaster@example.net">Webmaster</address>

## 8.2. The blockcode element

This element indicates that its contents are a block of "code" (see the code element). This element is similar to the pre element, in that whitespace in the enclosed text has semantic relevance. As a result, the default value of the @layout attribute is `relevant`.

Attributes

The Common collection
  A collection of other attribute collections, including: Bi-directional, Core, Edit, Embedding, Events, Forms, Hypertext, I18N, Map, Metainformation, and Role

Example of a code fragment:

    <blockcode class="Perl">
    sub squareFn {
        my $var = shift;
    	return $var * $var ;
    }
    </blockcode>

Here is how this might be rendered:

    sub squareFn {
        my $var = shift;
    	return $var * $var ;
    }

## 8.3. The blockquote element

This element designates a block of quoted text.

Attributes

The Common collection
  A collection of other attribute collections, including: Bi-directional, Core, Edit, Embedding, Events, Forms, Hypertext, I18N, Map, Metainformation, and Role

An excerpt from 'The Two Towers', by J.R.R. Tolkien, as a blockquote

    <blockquote cite="http://www.example.com/tolkien/twotowers.html">
    <p>They went in single file, running like hounds on a strong scent,
    and an eager light was in their eyes. Nearly due west the broad
    swath of the marching Orcs tramped its ugly slot; the sweet grass
    of Rohan had been bruised and blackened as they passed.</p>
    </blockquote>

## 8.4. The div element

The div element, in conjunction with the @id, @class and @role attributes, offers a generic mechanism for adding extra structure to documents. This element defines no presentational idioms on the content. Thus, authors may use this element in conjunction with style sheets, the @xml:lang attribute, etc., to tailor XHTML to their own needs and tastes.

Attributes

The Common collection
  A collection of other attribute collections, including: Bi-directional, Core, Edit, Embedding, Events, Forms, Hypertext, I18N, Map, Metainformation, and Role

For example, suppose you wish to make a presentation in XHTML, where each slide is enclosed in a separate element. You could use a div element, with a @class of `slide`:

div with a class of slide

    <body>
    	<h>The meaning of life</h>
    	<p>By Huntington B. Snark</p>
    	<div class="slide">
    		<h>What do I mean by "life"</h>
    		<p>....</p>
    	</div>
    	<div class="slide">
    		<h>What do I mean by "mean"?</h>
    		...
    	</div>
    	...
    </body>

## 8.5. The h element

The `h` element briefly describes the topic of the section it introduces. Heading information may be used by user agents, for example, to construct a table of contents for a document automatically.

Attributes

The Common collection
  A collection of other attribute collections, including: Bi-directional, Core, Edit, Embedding, Events, Forms, Hypertext, I18N, Map, Metainformation, and Role

Structured headings use the single h element, in combination with the section element to indicate the structure of the document, and the nesting of the sections indicates the importance of the heading. The heading for the section is the one that is a child of the section element.

Example

    <body>
    <h>This is a top level heading</h>
    <p>....</p>
    <section>
        <p>....</p>
        <h>This is a second-level heading</h>
        <p>....</p>
        <h>This is another second-level heading</h>
        <p>....</p>
    </section>
    <section>
        <p>....</p>
        <h>This is another second-level heading</h>
        <p>....</p>
        <section>
            <h>This is a third-level heading</h>
            <p>....</p>
        </section>
    </section>
    </body>

Sample style sheet for section levels

    h {font-family: sans-serif; font-weight: bold; font-size: 200%}
    section h {font-size: 150%} /* A second-level heading */
    section section h {font-size: 120%} /* A third-level heading */

Numbered sections and references
XHTML does not itself cause section numbers to be generated from headings. Style sheet languages such as CSS however allow authors to control the generation of section numbers.

## 8.6. The p element

The p element represents a paragraph.

In comparison with earlier versions of HTML, where a paragraph could only contain inline text, XHTML2's paragraphs represent a richer content model.

Attributes

The Common collection
  A collection of other attribute collections, including: Bi-directional, Core, Edit, Embedding, Events, Forms, Hypertext, I18N, Map, Metainformation, and Role

Note: We need another example in here contrasting usages.

Example

    <p>Payment options include:
    <ul>
    <li>cash</li>
    <li>credit card</li>
    <li>luncheon vouchers.</li>
    </ul>
    </p>

## 8.7. The pre element

The pre element indicates that whitespace in the enclosed text has semantic relevance. As such, the default value of the @layout attribute is relevant.

Note that all elements in the XHTML family preserve their whitespace in the document, which is only removed on rendering, via a style sheet, according to the rules of CSS [CSS3-TEXT]. This means that in principle any elements may preserve or collapse whitespace on rendering, under control of a style sheet.

Attributes

The Common collection
  A collection of other attribute collections, including: Bi-directional, Core, Edit, Embedding, Events, Forms, Hypertext, I18N, Map, Metainformation, and Role

A bad poem where whitespace matters

    <pre>
                    If
                  I   had
               any      talent
                  I   would
                   be a
                   poet
    </pre>

Here is how this might be rendered:

                    If
                  I   had
               any      talent
                  I   would
                   be a
                   poet

Note that while historically one use of the pre element has been as a container for source code, the new blockcode element more appropriate for that.

## 8.8. The section element

The section element, in conjunction with the h element, offers a mechanism for structuring documents into sections. This element defines content to be block-level but imposes no other presentational idioms on the content, which may otherwise be controlled from a style sheet.

Attributes

The Common collection
  A collection of other attribute collections, including: Bi-directional, Core, Edit, Embedding, Events, Forms, Hypertext, I18N, Map, Metainformation, and Role

By representing the structure of documents explicitly using the section and h elements gives the author greater control over presentation possibilities than the traditional implicit structuring using numbered levels of headings. For instance, it is then possible to indicate the nesting of sections by causing a border to be displayed to the left of sections.

Example

    <body>
    <h>Events</h>
    <section>
    	<h>Introduction</h>
    	<p>....</p>
    	<h>Specifying events</h>
    	<p>...</p>
    	<section>
    		<h>Attaching events to the handler</h>
    		<p>...</p>
    	</section>
    	<section>
    		<h>Attaching events to the listener</h>
    		<p>...</p>
    	</section>
    	<section>
    		<h>Specifying the binding elsewhere</h>
    		<p>...</p>
    	</section>
    </section>
    </body>

## 8.9. The separator element

The separator element separates parts of the document from each other.

Attributes

The Common collection
  A collection of other attribute collections, including: Bi-directional, Core, Edit, Embedding, Events, Forms, Hypertext, I18N, Map, Metainformation, and Role

Example

    <p>This is some lead in text</p>
    <separator />
    <p>This is some additional, but separate text.</p>

Example

    <nl>
    <label>Navigation</label>
    <li href="/">Home</li>
    <li><separator/></li>
    <li href="prev">Previous</li>
    <li href="..">Up</li>
    <li href="next">Next</li>
    </nl>

## 8.10. Issues

[XHTML2] How are UAs to interpret <h> and <hx> elements? PR #7820
State: Open
Resolution: None
User: None

Notes:

[XHTML2] How are UAs to interpret <h> and <hx> elements? PR #7830
State: Open
Resolution: None
User: None

Notes:

block@kind vs elt@structure PR #7874
State: Open
Resolution: None
User: None

Notes:

What is the scope of a header? PR #7878
State: Approved
Resolution: Accepted
User: None

Notes:
Group agrees that the scope needs a better explanation.