# 9. XHTML Text Module

Contents

This section is normative.

This module defines all of the basic text container elements, attributes, and their content models that are "inline level". Note that while the concept of "inline level" can be construed as a presentation aspect, in this case it is intended to only have a semantic meaning.

Element | Attributes | Content Model
--- | --- | ---
abbr | Common, @full | ( Text)*
br | Common | EMPTY
cite | Common | ( Text)*
code | Common | ( Text)*
dfn | Common | ( Text)*
em | Common | ( Text)*
kbd | Common | ( Text)*
l | Common | ( Text)*
q | Common | ( Text)*
samp | Common | ( Text)*
span | Common | ( Text)*
strong | Common | ( Text)*
sub | Common | ( Text)*
sup | Common | ( Text)*
var | Common | ( Text)*

The content model for this module defines a content set:

Text
  PCDATA | abbr | br | cite | code | del | dfn | em | ins | kbd | object | q | ruby | samp | span | strong | title | var | XForms_Form_Controls

Implementations: RELAX NG, XML Schema

## 9.1. The abbr element

The abbr element indicates that a text fragment is an abbreviation (e.g., W3C, XML, Inc., Ltd., Mass., etc.); this includes acronyms.

Attributes

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

full = IDREF
  This attribute locates an element that defines the full expansion of an abbreviation. The referenced element must be in the same document as the abbreviation.

The content of the abbr element specifies the abbreviated expression itself, as it would normally appear in running text. The @title or @full attributes may be used to provide the full or expanded form of the expression. Such an attribute should be repeated each time the abbreviation is used in the document.

Examples

    <abbr title="Limited">Ltd.</abbr>
    <abbr title="Abbreviation">abbr.</abbr>
    <p>The <dfn id="w3c">World Wide Web Consortium</dfn> (<abbr full="#w3c">W3C</abbr>)
       develops interoperable technologies (specifications, guidelines, software, and tools)
       to lead the Web to its full potential. <abbr full="#w3c">W3C</abbr> is a forum for
       information, commerce, communication, and collective understanding.</p>

## 9.2. The br element

This element is deprecated.

The br element indicates that the current output line should be ended at this point, and a new line begun. This element is deprecated in favor of the line element.

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 class="poem" xml:lang="fr">
    Un petit d'un petit<br/>
    S'etonne aux Halles.<br/>
    Un petit d'un petit,<br/>
    Ah! Degres te fallent.
    </p>

## 9.3. The cite element

The cite element contains a citation or a reference to other sources.

Attributes

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

In the following example, the cite element is used to reference the book from which the quotation is taken:

cite as book reference

    As Gandalf the White said in
    <cite cite="http://www.example.com/books/the_two_towers">The Two Towers</cite>,
    <quote xml:lang="en">"The hospitality of
    your hall is somewhat lessened of late, Theoden King."</quote>

cite to reference another specification

    More information can be found in
    <cite cite="http://www.w3.org/TR/REC-xml">[XML]</cite>.

## 9.4. The code element

The code element contains a fragment of computer code.

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

    The Pascal statement <code>i := 1;</code> assigns the
    literal value one to the variable <var>i</var>.

## 9.5. The dfn element

The dfn element contains the defining instance of the enclosed term.

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 role="definition">
        An <dfn id="def-acronym">acronym</dfn> is a word
        formed from the initial letters or groups of letters of words in a
        set phrase or series of words.
    </p>

## 9.6. The em element

The em element indicates emphasis for its contents.

Note that if em elements are nested, this indicates a higher level of emphasis.

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

    Do <em>not</em> phone before 9 a.m.

## 9.7. The kbd element

The kbd element indicates input to be entered by the user.

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

    To exit, type <kbd>QUIT</kbd>.

## 9.8. The l element

The l element represents a semantic line of text (e.g., a line of verse or a line of computer code).

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 retaining structure in text that has to be broken over lines, you retain essential information about its makeup. This gives you greater freedom with styling the content. For instance, line numbers can be generated automatically from the style sheet if needed.

Sample program listing

    <blockcode class="program">
    <l>program p(input, output);</l>
    <l>begin</l>
    <l>	writeln("Hello world");</l>
    <l>end.</l>
    </blockcode>

CSS Style sheet to number each line

    .program { counter-reset: linenumber }
    l:before {
    	position: relative;
    	left: -1em;
    	counter-increment: linenumber;
    	content: counter(linenumber);
    }

## 9.9. The q element

This element designates an inline text fragment 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

Visual user agents must not by default add delimiting quotation marks (as was the case for the `q` element in earlier versions of XHTML and HTML). It is the responsibility of the document author to add any required quotation marks, either directly in the text, or via a style sheet.

Nested quotations using q

    <p>John said, <q>"I saw Lucy at lunch, she told me
    <q>'Mary wants you
    to get some ice cream on your way home.'</q> I think I will get
    some at Jen and Berry's, on Gloucester Road."</q></p>

q with a cite attribute

    Steven replied:
    <q cite="http://lists.example.org/2002/01.html">We quite agree</q>

## 9.10. The samp element

The samp element designates sample output from programs, scripts, etc.

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

    On starting, you will see the prompt <samp>$ </samp>.

## 9.11. The span element

The span element, in conjunction with the @id, @class and @role attributes, offers a generic mechanism for adding structure to documents. This element imposes no presentational idioms on the content. Thus, authors may use this element in conjunction with style sheets, the @xml:lang attribute, the @dir 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

Example of span for cross references

    <p>This operation is called
    the <span class="xref">transpose</span>
    or <span class="xref">inverse</span>.</p>

## 9.12. The strong element

The strong element indicates higher importance for its contents than that of the surrounding content.

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

    On <strong>Monday</strong> please put the rubbish out,
    but <em>not</em> before nightfall!

## 9.13. The sub element

The sub element indicates that its contents should regarded as a subscript.

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

          H<sub>2</sub>O

## 9.14. The sup element

The sup element indicates that its contents should be regarded as a super-script.

Attributes

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

Many scripts (e.g., French) require superscripts or subscripts for proper rendering. The sub and sup elements should be used to markup text in these cases.

Example

          E = mc<sup>2</sup>
          <span xml:lang="fr">M<sup>lle</sup> Dupont</span>

## 9.15. The var element

The var element indicates an instance of a variable or program argument.

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

    The parameter <var>ncols</var> represents
    the number of colors to use.