O'Reilly logo

Cascading Style Sheets (CSS) by Example by Steve Callihan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the SPAN Element

The SPAN element was first introduced as part of HTML 3.2 to enable Web authors to specify display characteristics for inline content (or “spans” of text). The SPAN element functions purely as a carrier of style information, possessing no display characteristics of its own.

The SPAN element provides a generic inline element in addition to the other specific inline elements (such as the I, B, EM, STRONG, SUP, and SUB elements, for instance).

For an example of using the SPAN element, add a style to your style sheet that applies overlining to any text nested inside of a SPAN element (delete the style for the P element, while you're at it):

						p {  line-height: 1.5em; text-indent: 2em; margin-top: 0; margin-bottom: 0; text-
						

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required