HTML Web Page Background Image

 

HTML Web Page Background Image

You can display an image backgound within an HTML web page.

The BODY tag follows the HEAD tag within an HTML web page document.

The contents of your web page is displayed between the BODY tags. This includes everything displayed when viewed through a web browser.

You can display an image background within an HTML web page by adding the BACKGROUND attribute to your HTML BODY tag.

 

However, please ensure that you select your image very carefully and ensure your text can be easily viewed.

Please keep in mind, the best background color for a professional web page is always white.

HTML Image Background

Copy and paste the HTML BACKGROUND attribute into the BODY tag of your HTML code.

<body BACKGROUND="yourimage.gif">

Edit the text indicated in bold to the image you would like to display as your web page background.

CSS Image Background

You can also use CSS to specify a web page background color.

Place the following code between your <head> and </head> tags within your HTML.

<style type="text/css">
body {background-image:url(‘background.gif’);}
</style>

CSS Image Background – Repeat Horizontally or Vertically

When displaying and image background, the image will repeat vertically and horizontally.

 

 

 

 

However, you may want some images to repeat only vertically or horizontally.

 
The following example will only repeat your image horizontally.

 

 

 

 

<style type="text/css">
body
{
background-image:url(‘background.gif’);
background-repeat:repeat-x;
}
</style>

Although you can display an image background within your HTML web page, it is always best to display black text on a white background.

For additional information on HTML codes, visit the HTML Tutorial section.

For additional information on CSS codes, visit the CSS Tutorial section.

This concludes the HTML Web Page Background Image code.

 

 

 
Visit the following pages for a wealth of copy and paste codes and tips:

HTML Tips
Copy and paste special effect HTML codes for your web page.

HTML Codes
An HTML codes chart you can use to copy and paste codes into your web page.

HTML Color Codes
An HTML color codes chart you can use to copy and paste color codes into your web page.

JavaScript Codes
Copy and paste special effect JavaScript codes for your web page.

Web Design Tips
Tips, tricks, and special effect codes for your web page.

HTML Tags
A list of HTML tags.

HTML 5 Tags
A list of the latest HTML tags to be developed.

ASCII Codes
Special text characters and code for your web page.