- Enhanced <BODY> tag:
extensions for <BODY> tag.
1-9 Background color for body of web page
If you want you can change background color of your web page by extending <body> tag as
below.
Example:
" <HTML>
<HEAD>
<TITLE>Page with Back Color</TITLE>
</HEAD>
<BODY BGCOLOR="#00FF00">
Page with Back Color
</BODY>
</HTML>
This will change your background color to green. Format of color number is RRGGBB. You know
that each color is a combination of three main colors: Red, Green and Blue. In color format RR is
value of red component of the main color in hexadecimal format. GG is value of green
component and BB is the value of blue component.
Two digit hexadecimal number can be anything between 00 to FF i.e. 0 to 255 in decimal format.
So if we write 00FF00 we mean (red=0, green=255, blue=0) so the result is a pure green color.
You can produce 16 million colors in this way but pay attention that not all of the browsers will be
capable to show all these colors. So test your web page in 256 colors mode.
- Background Image:
ready image file in .gif or .jpg formats. Now you must extend <BODY> tag as below. "image1.gif"
is file name of he image we want to use as background image.
<BODY BACKGROUND="image1.gif">
Example:
<HTML>
<HEAD>
<TITLE>Page with background image</TITLE>
</HEAD>
<BODY BACKGROUND="image1.gif">
<B>Page with background image.</B>
</BODY>
</HTML>
Image file must be in the same folder as your html file. Otherwise browser will not be able to find it.
- Exercises:
1- Write your web page code with image1.gif as its background picture.
2- Write above code with a blue color instead of image as its background.
3- List tags you learned in this lesson with a small description.
In the next section we will get into text manipulation and formatting.