<span>

  • Revision slug: HTML/Element/span
  • Revision title: span
  • Revision id: 17397
  • Created:
  • Creator: hobophobe
  • Is current revision? No
  • Comment Fix indentation of example.; 4 words added

Revision Content

This HTML element is a generic inline container for phrasing content, which does not inherently represent anything. It can be used to group elements for styling purposes (using the class or id attributes), or because they share attribute values, such as lang. It should be used only when no other semantic element is appropriate. <span> is very much lika a {{ HTMLElement("div") }} element, but {{ HTMLElement("div") }} is a block-level element whereas a <span> is an inline element.

Attributes

Like all other HTML elements, this element has the global attributes.

Examples

<p><span>Some text</span></p>

Result

Some text

Revision Source

<p>This HTML element is a generic inline container for phrasing content, which does not inherently represent anything. It can be used to group elements for styling purposes (using the <strong>class</strong> or <strong>id</strong> attributes), or because they share attribute values, such as <strong>lang</strong>. It should be used only when no other semantic element is appropriate. &lt;span&gt; is very much lika a {{ HTMLElement("div") }} element, but {{ HTMLElement("div") }} is a block-level element whereas a &lt;span&gt; is an inline element.</p>
<h2>Attributes</h2>
<p>Like all other HTML elements, this element has the <a href="../../../../en/HTML/Global_attributes" rel="internal">global attributes</a>.</p>
<h2>Examples</h2>
<pre class="brush: html">&lt;p&gt;&lt;span&gt;Some text&lt;/span&gt;&lt;/p&gt;
</pre>
<h4>Result</h4>
<p><span>Some text</span></p>
Revert to this revision