Constructing Content
Figure 4-21. The contents of small are proportionally smaller than the surrounding text
Required Attributes
There are no required attributes for the small element.
Optional Attributes
The small element doesn’t offer any optional attributes.
span
The span element is a generic phrase element to set apart an arbitrary segment of text, whether to act as
a “hook” for CSS styling, or to carry additional information about its contents through attributes in the
opening <span> tag. A span is semantically neutral, and imparts no further meaning to its contents except
to say, “this text is somehow different.” As with its cousin the div, you should use a span only when a
more semantically valuable element doesn’t fit the bill.
Listing 4-35 shows a span within an h1 heading to distinguish the “last updated” date from the other
heading text. You could then style the contents of this span with CSS to appear different from the rest of
the heading. Other elements (i or b, perhaps) could serve the same purpose but they might imply
unwanted emphasis; this text isn’t special, it’s just different.
Listing 4-35. A span in a heading
<h1>Latest News <span>Last updated on August 14</span></h1>
Required Attributes
No attributes are required for the span element.
Optional Attributes
The span element has no optional attributes.
Programming: code, kbd, samp, and var
HTML offers a number of elements specially intended for marking up computer code, allowing computer
scientists, programmers, and web developers to publish and share their work.