HTML <span> Tag
Description
The <span>
HTML tag is an inline element used to apply styling or manipulate specific portions of text within a larger block of content, such as a paragraph or a heading. It does not add any structural significance to the content but serves as a container for applying CSS styles, JavaScript interactions, or other formatting changes. Developers often use the <span>
tag to change text color, font size, apply inline CSS, or target specific text for scripting purposes, making it a versatile tool for fine-grained control over the presentation and behavior of text within a web page.
Properties
- Permitted Parents
- Any element that accepts phrasing content, or any element that accepts flow content
- Content
- Inline and text
- Start/End Tags
- Start tag: required, End tag: required
Example
The color of the sky is <span style="color:blue;">blue</span>
Attributes
None
Global Attributes
The <span>
tag also supports the Global Attributes in HTML5
Event Attributes
The <span>
tag also supports the Event Attributes in HTML5
Browser Support
The following table will show you the current browser support for the HTML <span>
tag.
Desktop | |||||
12 | 1 | 1 | 15 | 1 |
Tablets / Mobile | |||||
18 | 4 | 14 | 1 | 1 | 4.4 |
Last updated by CSSPortal on: 30th September 2023