Monday, 2 February 2015

You saw in the previous chapter how every HTML document includes the <body> tag to enclose its content. By including attributes in the <body> tag, you can control certain aspects of document rendering. Let us cover these attributes one by one:

The Background
Unless you specify otherwise, a browser will render an HTML document on a white background. You can specify either a color or an image for the background. To specify a background color other than white, include the bgcolor attribute in the <body> tag. You can specify either a color name or a numerical value for the color. For example, the following <body> tag creates a document with a medium gray background:

<body bgcolor='#999999'>
To display an image in the page background, use the background attribute to specify the URL of the image:

<body background='url of the image'>

Here’s example:

<body background='images/mypic.gif'>

If the image is smaller than the browser window, it will be repeated to fill the area.

Background Cautions
When using a background for your Web page, either a color or an image, it is important to ensure that the text on the page remains easily readable. Black text on a blue background, for example, can be tough to read.

link : the color of normal links

alink : the color of an active link (the user has pressed but not yet released the mouse button on the link)

vlink : the color of links the user has visited

Each of these attributes could be set to a color name, RGB color value, or hex color value as described earlier.

Default Text
The default text color is black. To specify a different text color, use the text attribute in the <body> tag and set it to a different color. This <body> tag, for example, sets the default text color to blue.

<body text='#0000FF'>

You can still set selected portions of text to different colors using the <font> tag, which will be covered later in this section.


0 comments:

Post a Comment