Definition
A <span>
tag is an inline container that can be used to mark up text or other phrasing content elements, such as <abbr>
, <b>
, <em>
, <picture>
, and more.
Example
<p>This is some example <span style="color:red">red text</span>.</p>
This is some example red text.
Usage
- Both the opening and closing tags are required.
- The
<span>
element can be styled easily using CSS. You can even group various elements using CSS classes to style multiple elements the same. - The
<span>
element is similar to a<div>
in that it has no special or semantic meaning. However, where the<div>
is a block-level element, a<span>
is an inline element.
Attributes
The <span>
element only supports the Global Attributes.
Specification
Browser Support
Desktop
Chrome | Edge | Firefox | IE | Opera | Safari |
---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes |
Mobile
Android Webview | Chrome Android | Firefox Android | Opera Android | iOS Safari | Samsung Internet |
---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes |