Formatting ElementsIn other words, it ignores the most obvious formatting information that you, as an author, see: the way the text is already laid out in the file. It pays no more attention to the end of a line, for example, than to a space between words: as far as the browser is concerned, these are the same. It also ignores any apparent indenting or centering -- any number of spaces is equivalent to nothing more than a single space. Even the blank line between paragraphs is treated as nothing more than just a break between words.
This is similar to the "word-wrapping" feature in most word processors. The browser "wraps" the text to fit the space available. If two pieces of text represent separate paragraphs (and you would like them to look that way), then you have to tell the browser this, using (of course) an HTML element.
The element used to indicate paragraph divisions is the Paragraph element, designated by the P-tag:
<P> </P>.Notice that this element does not represent the start of a paragraph, nor the end, but encloses the whole paragraph.
There are many cases where P-tags aren't needed, because the element is its own paragraph, so a paragraph break is already implied. One place where this is true is around section headings (we'll learn about the heading elements shortly).
Within paragraphs and other paragraph-like elements, there's another, related element: the
<BR>or line break, element. This element tag is used when you want a particular piece of text to start on a new line, rather than being a whole new paragraph (or other element). The BR tag is NEVER a paired tag-- it doesn't contain anything, it just sits there in the middle of a paragraph.
Heading elements, as mentioned above, indicate the start of a new part (logically) of a document. There are different levels of heading, corresponding to the different levels of document structure. Rather than assume any particular structure on your part, the levels are simply numbered, and you may use them as you wish. The tags are <H1>, <H2>, <H3>, and so on. These are all paired tags.
For example, you might decide that level 1, the topmost level, should correspond to the "document" level; that is, that each different document you create will have a level 1 heading at the top. You might then decide that level 2 would correspond to chapter titles, level 3 would correspond to section headings, and level 4 to subsections. There are a total of 6 heading levels, but you don't have to use them all.
For most browsers, the effect that heading level has on the text is that the size changes (level 1 is the largest); headings might also be bolder than normal text. Keep in mind, though, that changing the text size is not the purpose of headings; it is simply the way they are most often expressed. The purpose is to clarify the different levels of structure within your document.
If you want to really separate sections, you can use the
<HR>, for an "Horizontal Rule" element. This draws a line across the page between the elements that it separates. Like BR, this is ALWAYS an unpaired tag.
For those who don't want to lose the formatting in their original text, there's the Preformatted element, indicated with the tags
<PRE> </PRE>(this one IS paired).
For more examples, see the Body Elements section of the HTML chart.