PDA

View Full Version : How do I get a fixed background on a web site?



Stephanie
17 Aug 2009, 06:29 PM
How do I get a fixed background on a web site? I want the background to stay in one place but when I scroll down for the menu to move, (Example: http://www.eteaket.co.uk/index.html) I am using Dreamweaver CS4.

Purcifur
18 Aug 2009, 03:47 PM
In the CSS for your website you should see some code that looks somewhat like this:


body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
background-image:url(CSSImages/bg.jpg); /* Obviously this will be different for your website
margin: 0;
padding: 0;
text-align: center;
color: #000000;
}

Add a new line that has


background-attachment: fixed;

Over all It'll look like this!


body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
background-image:url(CSSImages/bg.jpg); /* Obviously this will be different for your website
margin: 0;
padding: 0;
text-align: center;
color: #000000;
background-attachment: fixed;
}

This will lock your background image in place. Hope this helped!