Widely availableSupported across all major browsers. Safe to use in production.

Overview

The <span> HTML element is the generic inline container for content.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
1
12
1
1
18
1
DOM API

The HTMLSpanElement interface represents a span element and derives from the HTMLElement interface, but without implementing any additional properties or methods.

15
12
1
6
18
6
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)

Syntax

HTML
<p>Displays <span style="color: red">part of</span> the text <span style="color: red">in red</span>.</p>
<p>Price: <span class="price">¥1,200</span></p>

Live demo

inlinestyling

Span element in text. onepart to style apply.

PreviewFullscreen

Textdecoration

Text. onepart differentstyle in decoration. with span

PreviewFullscreen

Span and semntickelement. Compare Usage

meaning that exists case is semntickelement use, and only span.

PreviewFullscreen

Use cases

  • Using <span>

    The <span> HTML element is the generic inline container for content.

Cautions

  • May not be supported in older browsers.

Accessibility

  • Verify how this element is announced by screen readers.

Powered by web-features