Skip to main content

<span>


  • Date:
    03/05/2024
  • Modified:
    27/05/2026
  • Category:
    Elements

The <span> element is a generic inline container with no built-in semantics. Use it to apply inline styling or a language attribute to a stretch of text when no more specific element (<em>, <q>, <abbr>) applies.

Notes

  • Prefer the more specific element when one exists: <em> for emphasis, <q> for inline quotation, <abbr> for abbreviations.
  • Use <span xml:lang="..."> to mark up text in a different language than the surrounding paragraph.
  • A bare <span> without attributes adds no information and should not be used.

Attributes

NameExplanationRequired
xml:lang

This is a global xml attribute to define the language of a node.

Yes
fontStyles

Inline style attributes. See Global attributes.

No
fontTypes

Inline style attributes. See Global attributes.

No
foregroundColor

Inline style attributes. See Global attributes.

No
backgroundColor

Inline style attributes. See Global attributes.

No
textDir

Inline style attributes. See Global attributes.

No

Examples

Marking a foreign-language phrase

<p>De Romeinen kenden de <span xml:lang="la-LA" fontStyles="italic">cursus honorum</span>,
   een vaste politieke loopbaan.</p>

Applying a color to a label

<p>Lees op de verpakking of er een waarschuwing <span foregroundColor="red" fontStyles="bold">GEVAAR</span> staat.</p>

Marking a region with mixed scripts

<p>De Japanse term <span xml:lang="ja-JA">「いただきます」</span> wordt uitgesproken vóór de maaltijd.</p>

  • Date:
    03/05/2024
  • Modified:
    27/05/2026
  • Category: