structure

<span>

Generic inline container with no semantic meaning, used to style or script a run of text or inline content. Use it when semantic inline elements like <em>, <strong>, or <code> don't fit.

<span class="highlight">text</span>

Common attributes

Attribute Purpose
class CSS class hook
id Unique identifier
style Inline CSS
title Advisory tooltip text

Examples

<p>Total: <span class="price">$19</span></p>

Style a piece of inline text

<span title="World Health Organization">WHO</span>

Tooltip on hover

<span aria-live="polite" id="status"></span>

Announces updates to assistive tech

Gotcha

is inline — it cannot legally contain block elements like

or

. Prefer semantic inline tags (em, strong, code, mark) when meaning matters.

Related tags

← All HTML tags · CSS selectors · HTML entities