HTML Tutorial





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
HTML Basic
Introduction
How To
HTML Tags
html, head, body
Text Manipulation
IMAGES
Special Effects
Using Tables
Forms
Other Topics
 

ADVANCED HTML
Introduction
Media
Meta Tag
Frame tags
Fieldset
Tooltip
DTD
Image tags
Subscript & Superscript
Bullet styles
Canvas
Other tags
Ask Your Doubts
More about HTML
Feedback
 




HTML Body Background Image


Tutorials Html

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
Code:
<html>
<head>
<title> My Page
</title>
</head>

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

Test It:
Copy the code or type the code in to the textbox shown under subtopics and click show.
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.






Other Links

web hosting