HTML and CSS Reference
In-Depth Information
You'd soon discover, too, if you hadn't read it here first, that except
in special cases, browsers typically ignore leading and trailing spaces,
and sometimes more than a few in between. (If you look closely at the
source example, the line "Greetings from" looks like it should be inden-
ted by leading spaces, but it isn't in Figure 2-1 .) Divisions, paragraphs, and line breaks
A browser takes the text in the body of your document and "flows" it
onto the computer screen, disregarding any common carriage-return or
line-feed characters in the source. The browser fills as much of each
line of the display window as possible, beginning flush against the left
margin, before stopping after the rightmost word and moving on to the
next line. Resize the browser window, and the text reflows to fill the new
space, indicating HTML's inherent flexibility.
Of course, readers would rebel if your text just ran on and on, so HTML
and XHTML provide both explicit and implicit ways to control the basic
structure of your document. The most rudimentary and common ways
are with the division ( <div> ), paragraph ( <p> ), and line-break ( <br> )
tags. All break the text flow, which consequently restarts on a new line.
The differences are that the <div> and <p> tags define an elemental re-
gion of the document and text, respectively, the contents of which you
may specially align within the browser window, apply text styles to, and
alter with other block-related features.
Without special alignment attributes, the <div> and <br> tags simply
break a line of text and place subsequent characters on the next line.
The <p> tag adds more vertical space after the line break than either the
<div> or <br> tag. [ <div>, 4.1.1 ] [ <p>, 4.1.2 ] [ <br>, 4.6.1 ]
By the way, the HTML standard includes end tags for the paragraph and
division tags, but not for the line-break tag. [*] Few authors ever include
the paragraph end tag in their documents; the browser usually can fig-
ure out where one paragraph ends and another begins. [ ] Give yourself
a star if you knew that </p> even exists.
Search WWH ::

Custom Search