Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Html Set Background Colors and Images in HTML

Related Tutorials


 
 

Share on Google+Share on Google+

Set Background Colors and Images in HTML

Advertisement
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.

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

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: December 3, 2008

Related Tutorials

Discuss: Set Background Colors and Images in HTML   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:2
Ayush
June 19, 2012
background image in html

what is the destination of this image which is used in this code.
shahrukh khan
September 5, 2012
website

how to set image stored in computer as website background,which format and size of image is required
DMCA.com