
Hello World: Lesson 5 - Using Colour
So far, the web pages you've designed have been set against the default
colour of your browser - usually a dull, utilitarian grey. Changing the
background colour of your page requires you to add an attribute to the
tag that begins the bulk of content on your Web page. This is the BGCOLOR
attribute, and the one for this page is . There are a few other colours
you can assign as easily as this. For example, BGCOLOR=CYAN will transform
your page to a light blue colour (view the source code for this page and
try it out). Others are MAGENTA, RED and YELLOW.
Unfortunately, these simple tags only work well with a few colours. Most
other colours have to be represented in hexadecimal code (that is by numbers
using a base of 16, rather than 10 as in decimal, with letters A to F
for the numbers 10 to 15). These numbers consist of six digits prefaced
by the hash symbol (#), or three pairs representing the values for red,
green and blue (RGB). For example, the following tags would be:
.BGCOLOR=#FFFFFF - White
.BGCOLOR=#000000 - Black
.BGCOLOR=#FFFF00 - Yellow
.BGCOLOR=#00FF00 - Green
.BGCOLOR=#FF7F00 - Orange
.BGCOLOR=#9932CD - Purple
As you can see from the above list and the title of this page, colours
aren't limited to the background colour of your page. To change the colour
of text, you need to use the COLOR attribute with another tag, <FONT>.
Thus green text would use the <FONT COLOR="green"> </FONT>
element.
As with other text attributes, you should use font colours with care
if you don't want your page to look a mess. These colours, however, are
used to indicate the presence of hyperlinks, or to highlight headers,
and can be incredibly important for navigating a site.
Exercise
<HTML>
<HEAD>
<TITLE>The Hello World Web Site - Colours</TITLE>
</HEAD>
<BODY BGCOLOR="#ffff00">
<P><HR></P>
<FONT COLOR="#ff00ff"><H1 ALIGN=CENTER>Hello World!</H1></CENTER></FONT>
<P><HR><P>
<H2>History of HTML</H2><P>
<BLOCKQUOTE>
No doubt you've noticed a slight difference with this page compared to
previous ones (if not, adjust your screen, your eyes or your relation
to reality).<P>
Henceforth, these exercises will also serve as an opportunity to learn
more about the Internet, World Wide Web and HTML, beginning with a potted
history of the latter.<P>
HyperText Markup Language was devised by Tim Berniers-Lee in 1989 while
working at the European Centre for Nuclear Research (CERN) in Geneva.
At that time, the most popular way of transferring information across
the Internet apart from email was via a process known as File Transfer
Protocol (FTP). While fairly fast and efficient, FTP required users to
log onto each server, and Berniers-Lee wondered if there was a way to
connect inter-related documents and files to enable easier browsing from
one document to another.<P>
Thus was invented HyperText Transfer Protocol (HTTP), the set of rules
governing how servers around the world communicate with each other, and
HTML to provide a standard means of formatting information. Originally,
HTML was intended purely for scientists and formatted text only, but in
1992, Marc Andreessen (who later went onto form Netscape) added the ability
for Web pages to include images, beginning the process of transforming
the Internet into a multimedia environment.<P>
</BLOCKQUOTE>
</BODY>
</HTML>
To see what your page should look like, click here.
When you've finished, click on the Back button at the top of your browser
to return to this page.
|