I have the following html code:
<section class="first-content-top">
<img src="images/img-diner.png" />
<h1>Menu</h1>
</section>
<section class="first-content-middle">
<article class="menu">
</article>
</section>
<section class="first-content-bottom"></section>
With the following type of css:
.first-content-middle
{
background: url("images/bg-black.png") repeat;
margin: 0 0 0 37px;
padding: 0 20px;
width: 595px;
}
But in IE8 i still can't see a background image, like i see in IE9 or firefox:
Here's a picture of IE8:
And here is a picture of firefox, how it should be:
I tried the follwing solutions:
To prevent the problem i added the following html5shiv code to the head of the page:
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
And in firebug i checked to make sure that the section element has the display:block;
property set.
Edit: Adding the height
css property to the section fixes the background problem. But the section height is variable. So how do i fix that?
Any suggestions?
you need to set section to display:block in your CSS
from IE not styling HTML5 tags (with shiv)
IE7 and IE8 have native PNG support for alpha-transparencies, but it falls to pieces as soon as opacity comes into the picture. When setting any value for opacity, even 100% (ie. filter: alpha(opacity = 100)), IE fills in the alpha-transparency of the PNG with a pure black fill. This is sometimes refered to as a 'black halo'. The alpha filter can be removed at any time to remove the fill and restore the alpha transparency, but supporting both requires using more of IE's propriatary filters. All of the follow examples should be placed in a IE-targete
This might be related to your issue. Generally IE9 and below doesn't like transparency, opacity.
Surplus in ie7 and ie8 intead of being Transparent while using PNG transparent and opacity
.first-content-middle { background: url("images/bg-black.png") repeat scroll 0 0; margin: 0 0 0 37px; padding: 0 20px; width: 595px; }
remove transparent from background
Your png background image needs to be at least 4x4px.