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).
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
This content originally appeared on Envato Tuts+ Tutorials and was authored by Andy Leverenz
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/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.