HTML Span Tag

In HTML, the <span> tag is used to group elements for styling purposes.

  • <span> tag is also known as a generic container for the phrasing content.

  • <span> tag is much similar to <div> tag ; but there is a difference as <div> is a block-level element while <span> is an inline element.

  • The <span> tag does not inherently use to represent anything.

HTML5 <span> tag-Syntax and Usage

The <span> tag requires the start(opening) tag and end(closing) tag.

Given below is the basic syntax:

<span>
..content here
</span>

HTML <span> Tag Basic Example

Below we have a basic example of the <span > tag:

HTML <span> Tag Attributes

This <span> tag does not have any specific attributes; though it supports both global and event attributes.

Browser Support for HTML <span> Tag

Following browsers support this attribute:

  • Firefox 1+

  • Google Chrome 1+

  • Internet Explorer 3+

  • Safari 1+

  • Opera 4+