HTML Element: span

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

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). 


Related HTML Elements

  • 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.

Learn More

Did you know? <span> was introduced to HTML by the Internationalization Working Group on September 25, 1995.


This content originally appeared on Envato Tuts+ Tutorials and was authored by Andy Leverenz

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

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.


This content originally appeared on Envato Tuts+ Tutorials and was authored by Andy Leverenz


Print Share Comment Cite Upload Translate Updates
APA

Andy Leverenz | Sciencx (2022-12-15T13:37:04+00:00) HTML Element: span. Retrieved from https://www.scien.cx/2022/12/15/html-element-span/

MLA
" » HTML Element: span." Andy Leverenz | Sciencx - Thursday December 15, 2022, https://www.scien.cx/2022/12/15/html-element-span/
HARVARD
Andy Leverenz | Sciencx Thursday December 15, 2022 » HTML Element: span., viewed ,<https://www.scien.cx/2022/12/15/html-element-span/>
VANCOUVER
Andy Leverenz | Sciencx - » HTML Element: span. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/12/15/html-element-span/
CHICAGO
" » HTML Element: span." Andy Leverenz | Sciencx - Accessed . https://www.scien.cx/2022/12/15/html-element-span/
IEEE
" » HTML Element: span." Andy Leverenz | Sciencx [Online]. Available: https://www.scien.cx/2022/12/15/html-element-span/. [Accessed: ]
rf:citation
» HTML Element: span | Andy Leverenz | Sciencx | https://www.scien.cx/2022/12/15/html-element-span/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.