HTML Authoring
Writing for the World Wide Web
Author: Rachel Churcher.
Worksheet 4
OTHER COMMANDS IN HTML
This worksheet will demonstrate how to change the colours of text and backgrounds,
how to use lists and how to use the "align" command. You can either complete this
worksheet by writing the HTML in Notepad, or by using the Netscape Editor ("File" -
> "New Document" -> "Blank"). If you use the Editor, make sure you look at the
source document for the page. Use the Editor like a word processor and experiment
with the different menus to control colours, lists and text alignment.
COLOUR
- You can change the colours of the background and the text in your web page.
- Open Notepad.
- Create a new HTML document using the following basic HTML:
- Save it as "page2.htm"
- If you loaded this page into Netscape it would look similar to your first page, with
black writing on a white background.
BACKGROUND COLOUR
- To change the background colour of the page you use the "bgcolor" command (note
American spelling). This is an attribute of the <BODY> command which means that
it forms part of the <BODY> tag, and is written <BODY BGCOLOR=colour>. There
is no </TAG> for attributes - they are assumed to end when the main command ends:
<TAG ATTRIBUTE=.....> ..... </TAG>
- Colours are specified using 6 figure Hexadecimal codes. The first two digits specify
the level of red, the third and fourth specify the level of green and the fifth and sixth
specify the level of blue:
- The colour values range from "00" to "FF", with the six highest values represented by
the letters A-F. The table below shows some examples of colours and their codes:
| Black | #000000 | |
| White | #FFFFFF | |
| Bright red | #FF0000 | |
| Bright green | #00FF00 | |
| Bright blue | #0000FF | |
| Grey | #C0C0C0 | |
| Yellow | #FFFF00 | |
| Purple | #800080 | |
| Dark brown | #300000 | |
| Cream | #FFFFF0 | |
- Return to your HTML file in Notepad. Replace the <BODY> tag with <BODY
BGCOLOR="#rrggbb"> where the code indicates your choice of colour. Save the file
and close Notepad.
- Open Netscape and use the "File" -> "Open Document in Browser" command to open
"page2.htm" Your second page should appear with a new background colour.
TEXT COLOUR
- Open Notepad and return to your HTML document "page2.htm".
- The command to change the colour of your text is another attribute of the <BODY>
tag:
<BODY BGCOLOR="#rrggbb" TEXT="#rrggbb">
- Add the "text" attribute to the <BODY> tag with an appropriate colour code.
- Save the document, close Notepad and open the file in Netscape to see your text
colour.
LISTS
- You can put bulleted lists on your web page using the <UL>...</UL> tags.
- Open your HTML document in Notepad. Just before the </BODY> tag add the
following:
<P>
Here is a list of the pages I have written so far:
<BR>
<UL>
<LI>My first web page
<LI>My second web page
</UL>
- Save your document, close Notepad and open the document in Netscape. You should
see a bulleted list at the end of your page.
- Note that the whole list is enclosed by the tags <UL>....</UL> (Unordered list), and
each bullet is preceded by <LI> (List item). Like the tag <P>, </LI> is implied by the
new <LI> tag and therefore not required.
- Try replacing the <UL>.... </UL> tags with <OL> and </OL> (Ordered List) and see
what happens to your list.
ALIGNMENT
- Text can be aligned to the left, the right or the centre of your page. The "Align"
command is an attribute of the <P> tag, and appears as:
<P ALIGN=RIGHT>, <P ALIGN=LEFT> and <P ALIGN=CENTER>.
- Open "page2.htm" on notepad and experiment with the align attribute. You could add
new paragraphs, or align the text in the existing document. View the changes in
Netscape.
HTML Index
Worksheet 1
Worksheet 2
Worksheet 3
Worksheet 4
Worksheet 5
Worksheet 6
Feedback
This page was created on 07/02/98 by AGP + RMC
© 1998 R. M. Churcher