1

I'd like to make an image the background of one of my html pages.

I tried

body
{
background-image:url('./images/backgroundimage.gif');
}

But this wouldn't make it appear as the background image. I feel like this should be working, but it isn't. Anyone have better ideas, or see what I have wrong with this idea?

Zack
  • 13,454
  • 24
  • 75
  • 113
  • Have you checked the dimensions of body...sometimes when the page is positioned absolute, the body does not have any height...so the background image would not be visible – Tejasva Dhyani Mar 14 '12 at 04:25
  • that doesn't look like a valid path. Either start with a double dot, /, or just "images...". Each of those means something different relative or absolute to the file though. – Chet Mar 14 '12 at 05:05

3 Answers3

0

Drop the single quotes and the ./

Also, make sure that file actually exists relative to the that css file's url.

Edit: also search.

Community
  • 1
  • 1
bkconrad
  • 2,620
  • 3
  • 20
  • 30
0

Try using this background-image:url(../Images/backgroundimage.gif); and as bkconrd suggestion, make sure your image file located in correct path(I assume you ain't newbie in HTML, hope you check your directory structure). you can Use inline css too
<body STYLE="background-image: url(../images/backgroundimage.gif)"></body>
(for testing purpose, But usage of Inline Style generally not recommended style of coding).

Hope this helps you, If not let us know .... Happy coding

iDroid
  • 1,140
  • 1
  • 13
  • 30
0

How about trying this. I think this will work because I have tested it.

body {
    background:url('./images/backgroundimage.gif') no-repeat 0 0;
}
MikeSmithDev
  • 15,731
  • 4
  • 58
  • 89
Shailender Arora
  • 7,674
  • 2
  • 31
  • 35