Contents
This section is informative. For the normative version, see [XHTML2].
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 | Minimal Content Model |
---|---|---|
abbr | Common, @full | (PCDATA | Text)* |
cite | Common | (PCDATA | Text)* |
code | Common | (PCDATA | Text)* |
dfn | Common | (PCDATA | Text)* |
em | Common | (PCDATA | Text)* |
kbd | Common | (PCDATA | Text)* |
l | Common | (PCDATA | Text)* |
q | Common | (PCDATA | Text)* |
samp | Common | (PCDATA | Text)* |
span | Common | (PCDATA | Text)* |
strong | Common | (PCDATA | Text)* |
sub | Common | (PCDATA | Text)* |
sup | Common | (PCDATA | Text)* |
var | Common | (PCDATA | Text)* |
l element content model
Content model of the l element should not allow nested linesThe content model for this module defines a content set:
Implementations: RELAX NG, XML Schema
The abbr element indicates that a text fragment is an abbreviation (e.g., W3C, XML, Inc., Ltd., Mass., etc.); this includes acronyms.
Attributes
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 <span id="w3c">World Wide Web Consortium</span> (<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>
The cite element contains a citation or a reference to other sources.
Attributes
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>.
The code element contains a fragment of computer code.
Attributes
Example
The Pascal statement <code>i := 1;</code> assigns the literal value one to the variable <var>i</var>.
The dfn element contains the defining instance of the enclosed term.
Attributes
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>
The em element indicates emphasis for its contents.
Attributes
Example
Do <em>not</em> phone before 9 a.m.
The kbd element indicates input to be entered by the user.
Attributes
Example
To exit, type <kbd>QUIT</kbd>.
The l element represents a semantic line of text (e.g., a line of verse or a line of computer code).
Attributes
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); }
This element designates an inline text fragment of quoted text.
Attributes
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>
The samp element designates sample output from programs, scripts, etc.
Attributes
Example
On starting, you will see the prompt <samp>$ </samp>.
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
Example of span for cross references
<p>This operation is called the <span class="xref">transpose</span> or <span class="xref">inverse</span>.</p>
The strong element indicates higher importance for its contents than that of the surrounding content.
Attributes
Example
On <strong>Monday</strong> please put the rubbish out, but <em>not</em> before nightfall!
The sub element indicates that its contents should regarded as a subscript.
Attributes
Example
H<sub >2</sub>O
The sup element indicates that its contents should be regarded as a super-script.
Attributes
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>
The var element indicates an instance of a variable or program argument.
Attributes
Example
The parameter <var>ncols</var> represents the number of colors to use.
PCData not in Text
PR #7876
State: Approved
Resolution: Accepted
User: None
Notes:
The group agrees that we should change the abstract module definitions such that
PCDATA is just included in Text.
XHTML 2.0: Text Module/<l> vs. <br /> element
PR #7882
State: Approved
Resolution: Accepted
User: None
Notes:
We will put br back into XHTML 2.
RE: [ off list ] XHTML 2.0 - dfn : Content model and usability
PR #7885
State: Approved
Resolution: Accepted
User: None
Notes:
The specification has always had the dfn element.
Re: [XHTML 2.0] emphesis
PR #7899
State: Approved
Resolution: Accepted
User: None
Notes:
The working group has agreed that nested "em" elements should indicate higher
emphasis. This will be reflected in the text in a future draft.