user3545779
user3545779

Reputation: 97

How to set background?

I need to set a background image.. for the area which my site will not be using, throughout.

http://oi61.tinypic.com/903z4l.jpg

I need to add a background image in the GRAY part of the site.

My HTML code:

<html>
<body>
<?php include 'banner.php'; ?>
</body>
</html> 

The banner and navigation code, I have set them to center and 800px in banner.php, as u see in the pic:

#nav 
{
margin-left:auto;
margin-right:auto;
width:800px;
}

Upvotes: 0

Views: 78

Answers (2)

Drogon
Drogon

Reputation: 360

body{
   background:url('image.png');
}
.centerDiv{
   width:800px;
   margin:0 auto;
   background:#fff;
   height:100%;
}

That should work for you.

Upvotes: 0

Daan
Daan

Reputation: 2799

Add a background to the body of the HTML. This can be done with CSS.

CSS:

body {
    background-image:url("background.jpg");
}

Note: This background will repeat over and over, in order make it non-repeatable you could use:

body {
    background:url("background.jpg") no-repeat;
}

Update:

Your HTML code needs to have a div with the id of nav, so it overlaps the background:

<html>
<body>
    <div id="nav"></div>
</body>
</html> 

All the content you add into the div nav will now overlap the background.

Upvotes: 1

Related Questions