HTML and CSS Reference
In-Depth Information
Retaining formatting: pre
Now, what about pre ? The visual effect caused by the pre element is to preserve
the whitespace (that is, the tabs, spaces, and line breaks) in your markup, so if that
whitespace is important in understanding the content, such as in computer code samples,
then use pre . Alternatively, the effect can be replicated with the CSS white-
space:pre property and value, and this may well be a more viable option to use in
cases where another element could be used that better describes the content in question.
For example, in the case of marking up computer code, the code element along with
the white-space CSS property could be used to preserve the formatting as well as
convey the meaning of the content for situations where the formatting may be lost (such
as if it were read by screen-reading software, for instance).
Quoting text: blockquote
blockquote is an element that has historically been used for its presentational effect
rather than its semantic meaning or structural relevance, but it should be viewed as en-
closing content that is quoted from another source, regardless of how it will be presen-
ted. The blockquote element has a cite attribute, which allows the author to ref-
erence the source of the quote (usually in the form of a URL, but it can be any form of
citation, such as the name of another author or the title of a movie).
Note For inline quotations that appear in a paragraph, for instance, there also exists
the q element, which is listed in the text-level semantics section in Chapter 3 .
Three list types are available in the current HTML specification: unordered lists ( ul ),
ordered lists ( ol ), and description lists ( dl ).
The differences between the list types are fairly minimal and straightforward:
• An unordered list should be used when your content is (as you would
expect) not in any particular order.
• An ordered list should be used when your content is in an order of
some kind: alphabetical, numerical, and so on.
• A description list is designed for associating names or terms with val-
ues or other data—any items that have a direct relationship with one
another, such as a glossary of terms.
Search WWH ::

Custom Search