HTML and CSS Reference
As you can see, the headings get smaller as they decrease in
Both headings and paragraphs automatically break the flow of text at
the position of their end tag. Although the previous markup shows the
elements on separate lines to match the screenshot, this isn't necessary.
The markup could be all on a single line, and it wouldn't change the
results in the browser—all whitespace characters (see sidebar) are col-
lapsed to a single space.
Whitespace is a collective term for any sort of spacing character. To understand
it fully, we need to take a step back and consider what a text file really is. A text
file is a long list of characters, some of which are special control characters to
indicate line feeds, carriage returns, and tab stops. Think of an old-style teletype
or line printer with a print head: these characters are instructions telling the print
head to do something other than print a character but that does take up space.
On modern computers, these characters control the layout you see in a text ed-
itor; you see several lines of text, but only because the text contains several car-
riage returns and line feeds. For HTML purposes, many of the control characters
are considered whitespace. The full list of these characters is as follows: space,
tab, form feed, zero-width space, carriage return, line feed, and combined car-
riage return and line feed.
Here's an example with longer paragraphs. The markup is wrapped at
70 characters, ignoring the position of the tags. The tags are shown in
bold so they're easier to spot:
<h1> A quote from Ada Lovelace </h1><p> The Analytical Engine has no
pretensions whatever to originate anything. It can do whatever we
know how to order it to perform. It can follow analysis, but it has
no power of anticipating any analytical revelations or truths. Its
province is to assist us in making available what we are already
acquainted with. </p><p> The Analytical Engine weaves algebraic
patterns, just as the Jacquard loom weaves flowers and leaves. </p>