Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Dal123

macrumors 6502a
Original poster
Oct 23, 2008
903
0
England
I am having trouble following w3schools.com's guide to insert a background image that is fixed. This image is my logo, was thinking of having it fixed, I want to add the links/ navigation there fixed too with contact details. But I'm failing at the first attempt of importing the simple image :mad:.
I've tried following their simple tutorial on just importing the image and I can do that; obviously looks crap positioning on the page.
Can somebody tell me what I'm doing wrong?

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<title>Untitled Document</title>
<head>

</head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<body>
<style type="text/css">
body
{ 
background-image:<img src="/Images/Logo-Website.gif">;
background-repeat: no-repeat;
background-attachment:fixed;
background-position: 30% 20%; 
}
</style>

</body>
</html>
 
Thanks very much, it worked. I also had to remove the / before Images.
Thank you very much!
 
Thanks very much, it worked. I also had to remove the / before Images.
Thank you very much!

You're very welcome. On a side note the path can be relative or absolute or start from the document root with the slash as to the background URL, just so folks out there know. I prefer always using relative as less overhead, less typing, and if I migrate the site to another server with a different document root, no issues.

-jim
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.