MMDT1021 Chapter 22 Notes - page 1

Using Background Color

Code Page
Here we have the standard page with no 'bgcolor=' body tag attribute. Result
Source
Here we have a page with 'bgcolor="#FFFF80"' body tag attribute. Result
Source
Here we have a page with 'bgcolor="SaddleBrown"' body tag attribute. Result
Source
If you want to see some more colors, check out the HTML Color Names page.

 

Using Background Images

Code Page
Here we have a dark background with white text. Result
Source
Here we have a very busy background. Result
Source
Here we have a background that does not tile. Result
Source
This background is a very thin graphic strip that tiles downwards nicely.

This is the graphic strip that the Hutchinson Leader uses, and here is the result.

Result
Source
If you want to see some more background images, check out this Backgrounds page.
Here is another example of using thin graphic strips  that tile. Hometown Realty

 

Centering Elements on a Page

Code Result
You can use the align="center" attribute.
<p align="center">This line is centered.</p>
<p>This line is not.</p>

This line is centered.

This line is not.

Or you can use the <center> tag.
<center>This line is centered.</center>
This line is not.

This line is centered.

This line is not.

The <center> tag is deprecated, use <div align="center">.
<div align="center">This line is centered.</div>
This line is not.
This line is centered.

This line is not.

 

Specifying the Margins

Code Page
Internet Explorer uses 'leftmargin' and 'topmargin' Result
Source
Older Netscape Navigator used 'marginwidth' and 'marginheight' Result
Source
Since unknown attributes are ignored, use both so margins work in both browsers. Result
Source