1. Home
  2. Computing & Technology
  3. Web Design / HTML

<span></span>

By Jennifer Kyrnin, About.com Guide

<span> Description:

The <span></span> tag allows you to provide localized formatting within documents.

<span> Web Browser Support:
<span> Attributes:
<span> End Tag:
</span> REQUIRED
<span> Contents:

Usually any HTML text that you want to specify a style for. The following tags are valid within the <span> tag:
a, acronym, applet, b, basefont, bdo, big, br, button, cite, code, dfn, em, font, i, iframe, img, input, kbd, label, map, object, q, s, samp, script, select, small, span, strike, strong, sub, sup, textarea, tt, u, var

<span> Valid Context:

The <span> tag is valid within the following tags:
a, acronym, address, applet, b, bdo, big, blockquote, body, button, caption, center, cite, code, dd, del, dfn, div, dt, em, fieldset, font, form, h1, h2, h3, h4, h5, h6, i, iframe, ins, kbd, label, legend, li, noframes, noscript, object, p, pre, q, s, samp, small, span, strike, strong, sub, sup, td, th, tt, u, var

<span> Usage:
  • change style of text within a paragraph
    <p>This is a paragraph with <span style="color : purple; text-decoration : line-through;">one short phrase</span> in purple, and crossed out.</p>
<span> Special Notes:
  • Unlike the div tag, you can use span within paragraph tags, but you can't use it to group block elements, like you can with the div tag.
More <span> Information:

Return to XHTML Element (HTML Tags) Library

Explore Web Design / HTML
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Web Design / HTML

©2009 About.com, a part of The New York Times Company.

All rights reserved.