Tuesday, April 24, 2012

BASICS OF WEB DESIGN: Adding Background Color to a Web Page

       To add the background color to the web page, we use the bgcolor attribute of the Body element to do so. As we already know from the previous tutorial, we can add color in three ways, either using of the predefined color names, the RGB hexadecimal color code or the decimal RGB color code although the hexadecimal color code is commonly used.
       Now open our saved file "first.html" with notepad and add the bgcolor attribute after the body element in the opening tag (of the Body tag) as shown below to make the page yellow. You can use the color picker to get the color code for yellow.


<head>
<title>the world is ending</title>
</head>
<body bgcolor="#ffff00">is the letters showing?
</body>
</html>  in hexadecimal. OR

<html>
<head>
<title>the world is ending</title>
</head>
<body bgcolor="rgb(255,255,0)">is the letters showing?
</body>
</html> in decimal OR

<html>
<head>
<title>the world is ending</title>
</head>
<body bgcolor="yellow">is the letters showing?
</body>
</html> using predefined colour name.

      Save your file and open it with a web browser. Which ever method you use, you'll end up getting a page that looks like the one in the picture. Thanks for viewing. In my next tutorial, i'll show you how to make comments that only a web developer can read but isn't displayed by the browser.

No comments:

Post a Comment