See which Web Hosts BuildThe.com has reviewed and recommends >>

HTML Background Image

Setting a HTML background image on your web page is very easy. There are two ways to accomplish it. The first, with strictly HTML code will still work, however it should be mentioned that the second method, which utilizes CSS (cascading style sheet) is preferred and recommended to comply with web coding standards and newer browser software and devices.

HTML Background Image Code

In the "body" tag of your HTML page, you simply add the background property and provide the full path to your background image, like so:
<body background="full/path/to/Image.jpg">

That's it, you now have a background image on your web page.

CSS Background Image Code

Using CSS is preferred for many reasons. It will be more reliable across different browser types and devices, plus it allows you to have more control over your background image. For example, you can specify exactly where on the screen the image should disply, whether or not it should repeat. Maybe you'll want it to repeat horizontally but not vertically? You can do that with CSS.

Here's the basic code to add your background image from your CSS style sheet:

body {
background-image: url("/full/path/to/Image.jpg");
}

See our CSS Tutorials for more information on additional adjustments you can make to your HTML background image from within your CSS style sheet.