tags:

views:

79

answers:

7

I have a background image set to my main div. The background image shows up fine in Chrome but doesn't show at all in IE. Any ideas on what would cause this?

<div class="container" style="height:900px; margin-top:0px; background-image:url(Images/bg-stadiuminner.jpg); background-repeat:no-repeat;;"> 

Thanks

A: 

Is the relative url available for both browsers? Attempt to plug in the url for your image in IE and see if you can even load the image from the attempted url.

Joel Etherton
+1  A: 

A few thoughts:

  1. You should really opt for a stylesheet instead of embedding styles right into your div.
  2. Your background may not be showing up because you never properly close your <div> with a </div>. Also you have an un-needed semicolon at the end of your style, but that probably wouldn't break anything.
Zachary
The div closes at the bottom of the page. There is more content in this div, so yes the div closes with </div>
Aaron
+2  A: 
.container {
    height:900px; 
    margin-top:0px;
    background:url(images/bg-stadiuminner.jpg) no-repeat;
}

<div class="container">

</div> 

This would be a better way - try using classes rather than inline styles where possible to make maintaining the code far easier.

you also had a double ;; which may very well confuse IE.

Ross
removed the double;; Problem still exists.
Aaron
see Pekka's answer - the image format (JPEG/CMYK) is also a reasonable cause for this problem
Ross
A: 

Don't you need quotes around that url?

style="background-image:url('paper.gif');"
egrunin
Not necessarily as per the standard
Pekka
I always have issues with `background-image` when I don't use 's
Thomas Clayson
Tried this, did not fix the problem.
Aaron
+3  A: 

The only thing that I can think of that could be causing this is that the JPEG file is in CMYK format rather than JPG. IE can't digest CMYK images.

I think a layout issue might be more probable, though. Are you 100% sure the DIV is stretching to where you expect it to stretch? What happens if you set a background colour?

Pekka
this is a good point, and the cause of many a headaches !
Ross
A: 

As Pekka Commented up top. It was an issue with the jpeg its self. I was unable to open the jpeg in photoshop due to an incorrect marker. I took a screenshot of the image and pasted that in photoshop, cropping the correct dimensions, re-saving the file and now everything works. Thanks Pekka for the direction!

Aaron
you should be thanking Pekka but glad you got it sorted anyway :)
Ross
A: 

You are using inline style and also using the class 'container'. In the inline code there is no problem except there is ';;' at end of the line. We cannot see what is there in the container class. The problem might be there in the container class

WGF