HTML Span Tag

HTML Span TagHTML Span Tag <span> is used to group certain elements within an HTML resource or webpage.

HTML Span Tag <span> usage itself will not change the way in which the spanned part of HTML resource is rendered, but yes by using the span HTML Tag we can change the way an element appears in a browser.

Once an element or a portion of HTML resource is wrapped within the span HTML Tag, we can then style the element with CSS Properties or even Javascript.

HTML Span tag <span> is a closed tag and hence needs a closing HTML Span tag </span>.


Syntax of using HTML Span Tag

<span>
Some text Here …
</span>

Example of using HTML Span Tag

HTML Span Tag Code Output

 I have two cars.
One is <span style="&quot;color: red; font-weight: bold;"> RED </span>
and other is <span>GREEN
</span>.

I have two cars. One is RED and other is GREEN.

In the HTML Span Tag example above we can see that the output contains the text “RED” and “GREEN” in red and green colors respectively. What we have done here is that we have formatted the “RED” and “GREEN” text using the Span HTML Tag so that they appear bold and in red and green color.

HTML Span Tag Support all HTML Global Attributes and HTML Event Attributes.


HTML Span Tag Supporting Browsers

S. No. Browser Supported(Yes/No)
1 Internet Explorer Yes
2 Firefox Yes
3 Google Chrome Yes
4 Opera Yes
5 Safari Yes

Tagged , , , , , , , , , , , , , , , , , , , , , , , . Bookmark the permalink.