2012-01-12 81 views
1

好吧,這一直讓我發瘋。在IE8中,背景漸變圖像不會顯示在頁眉或頁腳中,但會顯示其他背景圖像。我在IE9,Firefox,Chrome,Safari或Opera中沒有問題。我已經看過這裏和其他地方提供解決方案,但目前還沒有任何工作。使用HTML5和CSS3,我知道它有時候會在較舊的瀏覽器中變得怪異。頁眉和頁腳背景圖片不會顯示在IE8中

這裏是頁腳的代碼:

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; 
} 

我試圖顯示:塊和shorhand代碼等背景:網址(圖像/ BG- footer.png)repeat-x左上滾動;但都沒有工作。

該網站的測試區域可以找到here。當這個問題引起我的注意時,我正在開始將其轉換爲WordPress模板,所以CSS可能仍然有點混亂。

+0

查看本教程http://net.tutsplus.com/tutorials/html-css-techniques/how-to-make-all-browsers-render-html5-mark-up-correctly-even-ie6/ – einar 2012-01-13 02:09:27

+0

你有沒有檢查IE8是否支持HTML5的功能? – Isuru 2012-01-13 16:34:31

回答

3

這是因爲您使用的是html5 - ie8及以上版本不支持它。

嘗試modernizrhtml5 shiv

+0

+1 for modernizr – 2012-01-12 22:50:35

2

IE 8和下面不知道像<header><footer>新要素。您需要在文檔標題中使用諸如html5shim之類的東西。

嘗試添加下列到<head>部分:

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

我覺得自己像個白癡。這就說得通了。當我回到家時我會嘗試第一件事。謝謝! – bahstudios 2012-01-12 22:45:54

0

由於IE8和更早版本不支持頁眉和頁腳代碼(HTML5標籤)。您必須先創建它們。