HTML Body Background Image

Topic

How to set background image in html web page?

Explanation

background:


This is an attribute for body tag used for setting image or picture as a background.
<body background="./test.jpg">
</body>

The value for the attribute is the path of the image file.
In this example we have a image file named test.jpg in the same directory of the html file, so we use the path as ./test.jpg
It is mainly used when we want a common background a lines/stripes etc.
The image in our example, test.jpg is a very small one as shown here
So a very small image can be used to set the background of such a big page
Combining all the tags learned so far

Example Code:

<html>
<head>
<title> My Page
</title>
</head>
<body bgcolor="green" background="./test.jpg">
This is my first page </body>
</html>


Such a kind of background occur because when the image size is small it will be placed again next to it, until the size reaches the total height and width of the screen.