| Paragraph Formatting |
| Division Tag |
| The <div> tag was added to HTML with version 3. It can be used to control the alignment of a section (or the whole) of a document. |
| Syntax |
HTML | Text |
|---|---|---|
<div align=left>
... </div> |
<div align=center>All
the paragraphs. <p>Will be centered</div>
|
All the
paragraphs.
Will be centered |
| The align attribute has another option, justify, but it is not support by any browsers, yet. |
| Paragraph Tag |
| HTML provides only limited paragraph formatting commands. The most fundamental is the paragraph tag itself! Each paragraph should begin with a start paragraph tag <p> and should end with an end paragraph tag </p>. In reality, most people ignore the end paragraph tag. In many cases people skip the start paragraph tag when it's superfluous such as after another end tag. |
| Syntax | HTML | Text |
|---|---|---|
<p> ... </p>
|
<p>this is the first
paragraph, |
this is the first paragraph, it will continue until the end tag or until another start paragraph tag is encountered. |
<p align=left> ...
</p> |
<p align=center>this
paragraph |
this paragraph is centred |
| Break Tag |
| The break tag <br> is used to force the browser to start a new line! The break tag <br> has been extended to allow image alignment to be terminated. |
| Syntax |
HTML |
Text |
|---|---|---|
<br> |
this text will have<br>a
break in the middle! |
this text will have a break in the middle! |
<br
clear=left|right|all> |
<img
src="star.gif" align=left width=30
height=30>this text will wrap around the image <br
clear=left> until the break. |
until the break. |
| See "Image Attributes" for information on image alignment. |
| No Break Tag |
| The no break tag <nobr> is a Netscape extension to HTML that ensures that the browser does not start a new line within the text with the tag. This tag should be used with care, because if too much text is included in the tags then it may make it difficult for the browser to format the text, or the result could look ragged. |
| Syntax | HTML | Text |
|---|---|---|
<nobr> |
Today's date is
<nobr>Sunday |
Today's date is |
| Heading Tags |
| There are six tags used to mark Headings: <h1> to <h6>. The higher the number the smaller the heading should be. Remember that the character formatting (font, size etc) can be set by each user... so don't assume that the font (or the font size) is the one you see on your browser! |
<h1>Major
Title</h1> |
| The heading tags are binary tags, so make sure you
remember to include the closing tag. See also: "Character Formatting - Font Tag". |
| Blockquote |
| Blockquote produces text that is indented in from both the left and right margins. The tag is intended to be used, as the name suggests, for paragraphs quoted from some source. |
| Syntax | HTML |
Text |
|---|---|---|
<blockquote> |
<blockquote> |
|
| Note that blockquote can be used with other tags... |
| Preformat |
| The <pre> tag is used to get fixed-width characters. In addition, the browser places new lines wherever they occur in the text. Normally the browser will ignore any new lines or spaces that are in the text, it will write the text across the page until it reaches the edge of the window! |
| Syntax | HTML | Text |
|---|---|---|
<pre> |
<pre>
As
you can
see the <b>Pre-Format</b>
tag can be very useful!!!
</pre>
|
As
you can
see the Pre-Format
tag can be very useful!!!
|
| Code Example |
| The <xmp> tag is very similar to <pre>
but it ignores any tags (or special characters) that are
placed in the text. For example, if you include <h1>
in the text, it is treated like any text... It's important to note that the browser will also ignore any character formatting such as <b> - the tag will simply be displayed like any other text. |
| Syntax | HTML | Text |
|---|---|---|
<xmp> |
<xmp>
All HTML tags are ignored
until the end tag is
encountered,
so if you put <h1>
inside <xmp> text,
it is treated like any text!
This is very useful when
giving examples of HTML!
</xmp>
|
inside
|
| Address Tag |
| This tag is used to enclose information such as "address, signature and authorship" (for more details see "HTML Document Structure"), the text in the tag is normally shown as italic. |
| Syntax | HTML | Text |
|---|---|---|
<address> |
<address> |
written by Stephen Peter School of Architecture, UNSW |
| Note that break and paragraph tags are allowed within the tag. |
| Center Tag |
| This tag is absolete use <div align=center> or
<p align=center> instead! Center does exactly what you would guess! All the information from the start tag <center> to the end tag </center> is centred. The tag is also an implied break tag, Netscape will start a new line for the centred text. Inside tables use <td align=center>. |
| Syntax | HTML | Text |
|---|---|---|
<center> |
All good fish |
|
Go to next section: Comments or return to the Contents page. |
||
| Last Updated: 28 September 1998 | ||