簡體   English   中英

IE6和IE7中未顯示背景圖片

[英]Background image is not displaying in IE6 and IE7

我有3個divs HTML標記

<div class="top-content-wrapper"></div>
<div id="content-wrapper">
</div>
<div class="bottom-content-wrapper">
</div>

已應用CSS

.top-content-wrapper {
background:url("img/white-box-top-bg.gif") no-repeat scroll left top transparent;
height:10px;
margin:0 auto;
padding:0 30px;
width:686px;
}
#content-wrapper {
background:url("img/white-box-middle-bg.gif") repeat-y scroll left top transparent;
margin:0 auto;
padding:10px 25px 70px;
width:696px;
}
.bottom-content-wrapper  {
background:url("img/white-box-bottom-bg.gif") no-repeat scroll left top transparent;
height:53px;
margin:0 auto;
padding:0 30px;
width:686px;
}

在所有主要的瀏覽器中,它都能正常工作,但在IE6和iE7中,背景沒有顯示,請幫幫我。 謝謝。

不確定,但可能是背景參數順序錯誤。 對其進行排序的正確方法是:

background: transparent url("img/white-box-middle-bg.gif") repeat-y scroll left top;

另外,正如Sam152在評論中所說,可能是您的div中沒有​​內容,因此它們根本不會在某些瀏覽器中顯示。

當您有空的div或僅包含空格的div時,某些瀏覽器(通常是IE)不喜歡它。 通常,最好插入一個不間斷空格&nbsp; )字符,以確保瀏覽器實際上認為值得顯示。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM