Paragraphs: Block Phrasing Content

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Paragraphs

Paragraphs
Paragraphs are the most rudimentary elements of a text document. You
indicate a paragraph with the p element by inserting an opening <p> tag at
the beginning of the paragraph and a closing </p> tag after it, as shown in
this example.
<p>Serif typefaces have small slabs at the ends of letter strokes. In
general, serif fonts can make large amounts of text easier to read.</p>

<p>Sans-serif fonts do not have serif slabs; their strokes are square
on the end. Helvetica and Arial are examples of sans-serif fonts.
In general, sans-serif fonts appear sleeker and more modern.</p>

Visual browsers nearly always display paragraphs on new lines with a bit of
space between them by default (to use a term from CSS, they are displayed
n oT e as a block). Paragraphs may contain text, images, and other inline elements
(called phrasing content in the spec), but they may not contain headings,
You must assign an element to all the
text in a document. In other words,
lists, sectioning elements, or any element that typically displays as a block
all text must be enclosed in some sort by default.
of element. Text that is not contained In HTML, it is OK to omit the closing </p> tag. A browser just assumes it is
within tags is called “naked” or “anony-
closed when it encounters the next block element. However, in the stricter
mous” text, and it will cause a document
to be invalid. For more information XHTML syntax, the closing tag is required (no surprise there). Many web
about checking documents for validity. developers, including myself, prefer to close paragraphs and all elements,
even in HTML, for the sake of consistency and clarity. I recommend folks
who are just learning markup, like yourself, do the same.

You might also like