You should have notice in the previous example that the browser did not display the line or paragraph breaks as they were entered in the text editor. This is because there were no HTML commands to instruct your browser to do so. Remember, any and all formatting that you want done must be done through use of appropriate HTML tags. The following sections describe some of the basic tags that are used to dress up the presentation of text on a Web page. The <P> (Paragraph) TagThe way to break text into paragraphs is by using the paragraph tag. Place a paragraph start tag <P> at the beginning of a new paragraph and the browser will know to insert a blank line before the first line of text. Adding a paragraph end tag </P> is optional as it is normally implied by the next open tag that comes along. Note that adding multiple <P> tags will not cause multiple blank lines to appear. Any and all such consecutive tags are treated as a single paragraph break.You can edit your previous HTML document to insert paragraph breaks:
<HTML>
A line is ended with the line break tag <BR>. This tag forces the browser to start a new line,
regardless of the position in the current line. Unlike the paragraph element, the line break does
not double-space the text. For example, the following markup,
<BODY>
Mary had a little lamb
The line break is an example of an empty tag (as opposed to container
tag) because the line break element does not have an end tag enclosing text elements.
<P ALIGN=LEFT|CENTER|RIGHT>
where you enter LEFT, CENTER, or RIGHT as the ALIGN parameter value. For example, the
specifications:
<P ALIGN=LEFT>This paragraph is aligned LEFT.
This paragraph is aligned LEFT.
This paragraph is aligned CENTER.
This paragraph is aligned RIGHT.
The default value for paragraph alignment is on the left. The alignment remains in effect until the
next paragraph marker is encountered. As you will learn later, the ALIGN attribute can be used for
other alignment
purposes besides paragraphs.
<CENTER>
This paragraph will be centered. So will this one. As will this one. The <BLOCKQUOTE> TagThe <BLOCKQUOTE> tag is used to indent text from the left margin, setting it off from the surrounding paragraphs. Automatic paragraph breaks appear before and after the block quote. This container can contain any of the other formatting or break tags. As a container tag, it is turned off by using the </BLOCKQUOTE> tag.The markup language:
Previous paragraph...
is rendered in the browser as:
Previous paragraph...
The <PRE> (Preformatted) TagPreformatted text specified by the <PRE> and </PRE> tags is rendered using a fixed-width, monospaced font (unlike the proportional font normally used to display text). Plus, it recognizes space characters, line feeds, tabs, and carriage returns. Text appears exactly as typed. This feature enables creation of items such as tables, columns of text, and blocks of computer code. The specifications:
are rendered exactly as typed. Note that the <PRE> tag causes an automatic paragraph break before and after the enclosed text. The drawback to using this tag is that the text is displayed in a rather uninteresting monospaced font. However, in later sections we will cover other techniques for creating table-like structures that give you full control over appearance while using the standard browser font. The <ADDRESS> TagOne of the most important parts of web documents is the address section. This is where you identify yourself as the author of the document, indicate any copyrighted material used, and let people now how to get in touch with you. The address section is normally placed at the beginning or end of a document and is identified by the <ADDRESS> tag. This tag is usually rendered in italics by the browser. Thus, the code:
<ADDRESS>
is displayed as
This page was designed by YourName You'll learn later how to assign a link to your address so that people who don't even know you can hassle you through the convenience of e-mail.
Multicolumns (Navigator 3.0 only)If you are using Netscape Navigator 3.0 then you can view text arranged in columns. The <MULTICOL> container tag encloses the text to be placed in columns and the COLS, GUTTER, and WIDTH attributes control the number of columns, the amount of space between columns, and the width of the columns, respectively. You can see the effect in the following layout:
<MULTICOL> - This tag begins the columnar definitions. All lines of text between this tag and the closing </MULTICOL> tag are placed in columns. The browser attempts to balance the amount of text in the columns to make them the same lengths. COLS - This attribute is required in the <MULTICOL> tag. It controls the number of columns into which the text is split. GUTTER - This attribute control the amount of space between columns. The default is 10 pixels. WIDTH - This attribute controls the width of individual columns. If not specified, column width is adjusted to fit within the width of the browser window. All columns are the same width. In this example the specification is <MULTICOL COLS=2 GUTTER=20> The WIDTH attribute is not used so that the layout will span the width of the browser window. The <SPACER> TagThe <SPACER> tag has the attributes:
TYPE=HORIZONTAL|VERTICAL|BLOCK Horizontal Space
<SPACER TYPE=HORIZONTAL SIZE=20>
This tag is placed at the beginning of a paragraph to insert a 20-pixel-width block of horizontal
white space simulating a paragraph indent.
Vertical Space
The space inserted
<SPACER TYPE=VERTICAL SIZE=20>
inserted between each of the lines.
Block Space
<SPACER TYPE=BLOCK WIDTH=70 HEIGHT=120 ALIGN=LEFT>
You may need to tinker with the width and height settings to get the exact look you want.
Galloping right along...
This section has covered most of the standard markup tags for typing and aligning paragraphs;
others will be introduced later. However, these are the most-often used paragraph tags and
parameters and will get you started in adding some variety to your presentations.
|