HTML <span>Tag


Examples

Use the <span> element to color a part of the text:

<p>My mother has <span style="color:blue">blue</span> eyes.</p>

Try it yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the <span> tag.


Tag Definition and Usage

The <span> tag is used to group inline elements in a document.

The <span> tag has no fixed format representation. When styles are applied to it, it produces visual changes. If styles are not applied to <span>, then the text in the <span> element will not have any visual difference from other text.

The <span> tag provides a way to separate a part of the text or a part of the document.


Tips and Notes

Tip:You can use CSS to define styles for the text contained in the <span> element, or use JavaScript to manipulate it.


Differences between HTML 4.01 and HTML5

NONE.


Global Attributes

The <span> tag supportsHTML Global Attributes。


Event Attributes

The <span> tag supportsHTML Event Attributes。

Other Extensions