Topic: HTML5 Tags ReferencePrev|Next
<span> tag is generic inline container for phrasing content, which has no default rendering or meaning. The
<span> tag is extensively used to define the structural sections of a document and to layout a web page using CSS.
The following table summarizes the usages context and the version history of this tag.
|Content:||Inline, and text|
|Start/End Tag:||Start tag: required, End tag: required|
|Version:||HTML 4, 4.01, 5|
<span> is very much like a
<div> element; both elements don't convey any meaning about its contents and also doesn't provide styling, or any other visual change. But
<div> is a block-level element while
<span> is an inline-level element.
The basic syntax of the
<span> tag is given with:
The example below shows the
<span> tag in action.
ExampleTry this code »
<p>Here is some <span style="color:red;">different</span> text.</p> <p>Read the <span class="important">Notes</span> carefully.</p>
<span> element is the most useful inline element for associating the styles and scripts with the content (using the
id attributes), since this element has no default rendering or meaning.
<span> tag doesn't have any specific attribute.
Like all other HTML tags, the
<span> tag supports the global attributes in HTML5.
<span> tag also supports the event attributes in HTML5.
<span> tag is supported in all major modern browsers.
See tutorial on: HTML Layout.