簡體   English   中英

頁眉和頁腳背景圖片不會在IE8中顯示

[英]Header and Footer background images won't show in IE8

好吧,這一直讓我發瘋。 在IE8中,背景漸變圖像不會顯示在頁眉或頁腳中,但會顯示其他背景圖像。 我在IE9,Firefox,Chrome,Safari或Opera中沒有問題。 我已經在這里和其他地方尋找了建議的解決方案,但是到目前為止,沒有一個工作。 使用HTML5和CSS3(在較舊的瀏覽器中有時會很時髦)。

這是頁腳的代碼:

footer {
text-align:center;
color:#f9f2e7;
font-size:14px; 
display:block;
background: #26b6c9;
background-image:url(images/bg-footer.png);
background-repeat:repeat-x;
background-attachment:scroll;
position:relative;
height:103px;
clear:both;
width:100%;
float:left;
}

這是標題:

header {
background: #26b6c9;
background-image:url(images/bg-header.png);
background-repeat:repeat-x;
background-attachment:scroll;
margin: 0 auto;
position:relative;
height:159px;
width:100%;
float:left;
}

我嘗試過display:block和shorhand代碼,例如background:url(images / bg-footer.png)repeat-x左上滾動; 但都不起作用。

該站點的測試區域可以在此處找到。 當我注意到此問題時,我正開始將其轉換為WordPress模板,因此CSS可能仍然有些混亂。

這是因為您使用的是html5-ie8和更早的版本不支持它。

試試modernizrhtml5 shiv

IE 8及更低版本不了解諸如<header><footer>類的新元素。 您需要在文檔標題中使用html5shim之類的格式

嘗試將以下內容添加到<head>部分:

<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

因為IE8和更早版本不支持頁眉和頁腳標簽(html5標簽)。 您必須先創建它們。

暫無
暫無

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

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