[an error occurred while processing this directive]

Set Background Colors and Images in HTML

                         

The  background colors can be set to the web pages by using the body attribute bgcolor and putting any color value into it in HTML Page.

Understand with Example

The Tutorial illustrates to set a background color in HTML. In this Tutorial, the code describe you an example that helps you to set background color in HTML. The code begin with a  start <html>tag , followed by < head>.Inside the <head>tag we have <title> tag, which define the title of the element. The <bgcolor> in HTML depicts you the color background of web page.

 

 

 

Example: Background Colors
<html>
<head><title>Example on the use of Background Colors in HTML</title></head>
<body bgcolor="blue">
</body>
</html>

Output shown in the Browser window will be like this- Result

Welcome to this HTML Page with background color blue


A web page can also be set to a background image. For this we use the body attribute background and write the address of the image into it.

Example: Background image
<html>
<head><title>Example on the use of Background image in HTML</title></head>
<body background="roop.gif">
</body>
</html>

If the image size is less than the size of the browser window, then the image automatically repeats itself until it fills the full size of the window.

Output shown in the Browser window will be like this- Result

 

Download Background Color

Download Background Image

                         

[an error occurred while processing this directive]