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-
						

Get Cascading Style Sheets (CSS) by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.