Scroll to top
1 min read

The <span> element is an inline element, which doesn’t really describe its content in any specific way. Because of this, it should only be used when there isn’t a more appropriate semantic element available.

You might use it for styling content (directly, or with the class or id attributes for example) or for grouping content for some other reason.

Example

Syntax

1
A <span>book</span> can take you around the world and back, all you have to do is <span>open it</span>.

Result

Please accept marketing cookies to load this content.

Browser Support

The <span> element is supported in all modern browsers. Read more on caniuse.com.


Attributes

The <span> tag supports Global Attributes in HTML. Global Attributes are common to all HTML elements and can be used on all of them (though they may not have much of an effect on some of them). 


  • The <span> element is similar to the <div> element, in that they’re both generic and don’t describe their content. However, <div> is a block level element.
Did you know? <span> was introduced to HTML by the Internationalization Working Group on September 25, 1995.