The background attribute can be used to designate an image file as a background to a page. The image would be tiled across the page if it is smaller than the browser window.
The syntax for this tag is:
The following are two methods for specifying color in a web page.<body background="filename.gif/jpg/png">
Since the #RRGGBB method works for all browsers, we will be using it exclusively.
The bgcolor attribute sets the background color of the page. Its syntax is:
The text attribute sets the color of the text on the page. This attribute will affect all the text not specifically colored by the <font> tag. Its syntax is:<body bgcolor="#RRGGBB">
The alink, vlink, and link attributes set the color of the links contained in the page. link refers to the color of the unvisited (unclicked) link. vlink refers to the color of the link after it has been visited (clicked). alink refers to the color of the link while it is active (while it is being clicked). The syntax of this attribute is:<body text="#RRGGBB">
<body link="#RRGGBB" vlink="#RRGGBB" alink="#RRGGBB">
The size attribute specifies the size of the font. Valid values range from 1 - 7 (1 being the smallest). For example:
This is font 1
This is font 2
This is font 3
This is font 4
This is font 5
This is font 6
This is font 7
The syntax for this
attribute is:
The face attribute sets the type of font displayed on the page. This attribute will only work correctly on computers that have the specified font installed on them. (i.e., if you want your page to use "Times New Roman" font, in order for a visitor to your page to see the font, they must have "Times New Roman" installed on their system.) This attribute is also currently supported only by Microsoft Internet Explorer and Netscape Navigator. The syntax for this attribute is:<basefont size="[1-7]">
<basefont face="font type (i.e., Arial)">
The color attribute sets the color of the text inside the container tag. The syntax of this attribute is:
This HTML text:<font color="#RRGGBB">Text to be changed</font>
would result in:<font color="#FF0000">This is red</font> <br> This is normal <br> <font color="#0000FF">This is blue</font>
This is red
This is normal
This is blue
The size attribute works the same as the size attribute of <basefont> in that it sets the size of the text inside the container tag. However, if the <basefont> tag has been used to set the font size for the page, you may change the size of the text relative to the base font (i.e. +2 would be the base font + 2). The syntax for this attribute is:
These tags:<font size="(1-7) or (+/- relative value)">
or<font size="2">This is set to font 2</font> This is not
would result in:<basefont size="3"> <font size="+2">This is set to font 5</font>
This is set to font 2 This is not
This is set to font 5
The face attribute sets the type of font of the text inside the container tag. This attribute will only work correctly on computers that have this type of font installed on them. (i.e. if you want your page to use "Times New Roman" font, in order for a visitor to your page to see that font, they must have "Times New Roman" installed on their system. This attribute is also only supported by Netscape Navigator and Internet Explorer. The syntax for this attribute is:
<font face="font type">
The <img> tag is used to display images on web pages.
Moreover, it is possible to control both the appearence of the image and how
it reacts to the surrounding text throught the use of the align,
alt, border, width, and height
attributes.
The align attribute controls the way text reacts to
the image. The syntax for this tag is:
The results of each of the align values are:<img src="image.xxx" align="left/right/top/middle/bottom>
align="left"This text is aligned to the left align="right"This text is aligned to the right align="top"This text is aligned to the top align="middle"This text is aligned to the middle align="bottom"This text is aligned to the bottom
The alt attribute is used to display text in place of the image when the image is not, or cannot be, loaded (usually when the user is viewing a page with a text-only browser.) The syntax for this attribute is:
For example, the following tag<img src="path/image.xxx" alt="alternate text">
would result, on a graphical browser, in:Edvard Munch <img src="scream.jpg" alt="The Scream">
Edvard Munchand a text-only browser in:
Edvard Munch <The Scream>
For example:<img src="image.xxx" border="size">
The width and height attributes set the size of the image in order to enlarge or reduce the size of the image. You can set the exact size of the image by specifying these attributes. For example, with our 140x109 image of Van Gough's "Starry Night",<img src="picasso.jpg" border="5">This is a border of size 5.
<img src="picasso.jpg" border="20">This is a border of size 20.
Becomes:<img src="starryNight.jpg"> <img src="starryNight.jpg" width="280" height="218">
It is not necessary to specify both height and width attributes for an image. If you only specify one, the browser will automatically scale the other.
HTML allows a page designer to present data in the form of a list. There are three main types of lists: ordered, unordered, and definition lists.
An ordered list, as its name implies, is used to display a list of items that are sorted by importance or sequence. An ordered list is created by using the <ol>...</ol> container tag. Each item is signified with the <li> (List Item) tag. The syntax for this tag is:
For example:<ol> <li>first item <li>second item ... </ol>
produces:<ol> <li>Do this first <li>Do this next <li>Do this last </ol>
- Do this first
- Do this next
- Do this last
It is possible to change the type of count marks (e.g., 1 2 3 to a b c, etc...) through the type attribute and the starting position through the start attribute.
There are five different types of count marks for use with
the type attribute:
The start attribute allows the list to be started anywhere within the list. For example,
type="A"capital letters (e.g. A, B, C, ...) type="a"lowercase letters (e.g. a, b, c, ...) type="I"capital roman numerals (e.g. I, II, III, ...) type="i"lowercase roman numerals (e.g. i, ii, iii, ...) type="1"default numbers (e.g. 1, 2, 3, ...)
For example:
This would result in<ol type=I start=3> <li>Open the file menu <li>Click on 'save as' <li>Type 'document.txt' <li>Click 'OK' </ol>
- Open the file menu
- Click on 'save as'
- Type 'document.txt'
- Click 'OK'
An unordered list is used
to present a list of items marked by bullet points instead of count marks. An
unordered list is created by using the <ul>...</ul> container tag.
As with an ordered list, each list element is denoted by the <li> tag.
The syntax for an unordered list is the same as that of an ordered
list.
An example of an unordered list is:
It is possible to change the shape of the bullet from the default disc to a square or a circle through the use of the type attribute. The type attribute may be used in the <ul> tag, to change all the bullets, or in the <li> tag, to change all bullets following that tag. For example:<ul> <li>Item one <li>Item two <li>Item three </ul>
- Item one
- Item two
- Item three
<ul type="square"> <li>Item one <li type="circle">Item two <li>Item three <li type="disc">Item four </ul>
- Item one
- Item two
- Item three
- Item four
The last major type of list that is supported by HTML is the definition list. A definition list consists of a list of terms followed by their corresponding definitions indented on the line below. A definition list is created by implementing the <dl>..</dl> container tag. Each term is denoted by the <dt> (Definition list Term) tag and, likewise, each definition is denoted by the <dd> (Definition list Definition) tag. The syntax for this tag is:
Which becomes:<dl> <dt>Dog <dd>(n.) a canine <dt>Cat <dd>(n.) a feline </dl>
- Dog
- (n.) a canine
- Cat
- (n.) a feline
It is possible to add not only images, but also add sound to web
pages; thus making them truly dynamic. The <embed> tag allows for the
addition of sound to a web page. Valid sound formats are WAV (.wav), AU (.au),
and MIDI (.mid). The syntax of this tag is:
The loop attribute defines the number of times the sound will repeat. The value would either be a number, signifying the number of repeats, or 'infinite,' signifying that the sound will repeat until a different page is loaded.<embed src="path/sound.xxx" loop="value">
The <embed> tag behaves very much like the <img> tag; however,
instead of displaying an image on the page, the <embed> tag plays the
specified sound and displays a console on the page.
This console allows the visitor to your page to stop, pause, and control the volume of the background sound. As with the <img> tag, the <embed> tag also allows the page designer to control the height and width of the console. In order to display the console as above, use the following values:
In order to not display the console at all, simply set the height and width attributes to 0.<embed src="sound.xxx" height="60" width="145">