• Have Any Question?
  • contact@eitworld.com

HTML Backgrounds





  • By default html webpage contains white color. You can change the background of html web page by using <body> tag.
  • You can use an image or plain color as the html web page background for this you need to specify it in the <body> tag.
  • In this tutorial we are going to introduce the use of image and plain color as your web page background.

Set an image as webpage background

 

    • If you want to add the image as the webpage background, you will need to specify in the <body> tag which image should be used for the background as given in the following syntax:
<body background=”image url”>
  • Here is an example to set an image as webpage background:
<!DOCTYPE html >
<html>
<body background=”bg.jpg”>
<h1>This is an example of setting an image as webpage background.</h1>
</body>
</html>

To see live output : Visit Try Yourself Editor

Output

Set plain color as webpage background

 

    • If you want to set plain color as the webpage background, you will need to specify in the <body> tag which color should be used for the background as given in the following syntax:
<body bgcolor=”color-name or hex code”>
  • Here is an example to set plain color as webpage background:
<!DOCTYPE html >
<html>
<body bgcolor=”cyan”>
<h1>This is an example of setting plain color as webpage background.</h1>
</body>
</html>

To see live output : Visit Try Yourself Editor

Output



Real Time Web Analytics