我有以下的html代碼:在IE 8中沒有顯示PNG背景圖像<使用html5?
<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>
與下列類型的CSS:
.first-content-middle
{
background: url("images/bg-black.png") repeat;
margin: 0 0 0 37px;
padding: 0 20px;
width: 595px;
}
但在IE8我依然看不到背景圖像,就像我在IE9或Firefox看:
下面是IE8的一個畫面:
這裏是火狐的一個畫面就應該是這樣:
我試過follwing解決方案:
爲了防止我問題補充以下html5shiv code to the page of head:
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
而在螢火蟲我檢查,以確保該部分元素具有display:block;
屬性集。
編輯:將height
css屬性添加到該部分可修復背景問題。但截面高度是可變的。那我該如何解決這個問題?
有什麼建議嗎?
我們可以在任何TESTSERVER或的jsfiddle檢查這個? – supersaiyan
注意:這裏是一個很好的測試,但是在製作時,如果IE IE 8和IE IE 9不在IE9和10上,那麼應該添加html5shiv。 – FelipeAls
@FelipeAlsacreations好的,謝謝你的提示。 – RTB