2014-06-20 70 views
2

我在我的網頁中有兩個動畫.gif圖像,但它們沒有在Firefox中顯示。它適用於IE,Safari和Chrome。我已閱讀其他帖子,但我找不到可行的解決方案。有人可以幫忙嗎?DIV圖像不顯示在Firefox中

這是網址: http://www.lokalbericht.unibe.ch

以下是代碼:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<title>Lokalbericht - Hermann Burger</title> 
<style type="text/css"> 
.text_body { 
    font-family: Arial, Helvetica, sans-serif; 
    font-size: 10px; 
} 
body { 
    background-color:#000000; 
    background-image:url(images/intro/background_paper.jpg); 
    background-position:center 50px; 
    background-repeat:no-repeat; 
    background-attachment:fixed; 

} 
div.soon { 
    content:url(images/intro/coming_soon.gif); 
    position: relative; 
    width:650px; 
    height:170px; 
    top:350px; 
    left:30%; 
} 

div.lokalbericht { 
    content:url(images/intro/animation.gif); 
    width:160px; 
    height:20px; 
    position: absolute; 
    top:300px; 
    left:45%; 

}​​ 
</style> 
</head> 

<body> 

<div class="soon"> &nbsp;</div> 
<div class="lokalbericht">&nbsp;</div> 

+0

'內容:網址(圖像/前奏/ animation.gif);' - 爲什麼不把它設置爲背景圖片,使用'背景:網址()' –

+1

不能使用'content'除非它與僞元素 –

+0

感謝Nick R.這是正確的解決方案 – user3760026

回答

0

我檢查你的鏈接。試試這個...

div.soon { 
background-image:url(images/intro/coming_soon.gif); 
position: relative; 
width:650px; 
height:170px; 
top:350px; 
left:30%; 
} 
div.lokalbericht { 
background-image:url(images/intro/animation.gif); 
width:160px; 
height:20px; 
position: absolute; 
top:300px; 
left:45%; 
}​​ 
+1

是的,它可以解決您的問題!謝謝。 – user3760026

+0

請通過單擊此解決方案中的刻度標記顯示來接受此解決方案。 – Prasath

+0

user376002:請通過單擊解決方案附近的刻度線來接受我的答案。 – Prasath

0

試試這個:

內容:您已設置負載背景圖像 CSS屬性是創造的問題,所以只是背景圖像替換成兩個給定類div.soondiv.lokalbericht

background-image:url(images/intro/coming_soon.gif); 
background-image:url(images/intro/animation.gif); 

在地方:

content:url(images/intro/coming_soon.gif); 

我希望這可以幫助你!

+0

此解決方案適用!和之前的帖子一樣!謝謝! – user3760026

+0

我很高興在這裏我可以幫助你。你也可以投我的答案。 :) –

0

Firefox不支持與Chrome相同的內容屬性 - 在img元素上和/或源是圖片時。

因此,您需要使用背景屬性而不是內容,或者您​​需要使用:before屬性之前的類如下。

div.soon:before { 
content:url(images/intro/coming_soon.gif); 
position: relative; 
width:650px; 
height:170px; 
top:350px; 
left:30%; 
} 

div.lokalbericht:before { 
content:url(images/intro/animation.gif); 
width:160px; 
height:20px; 
position: absolute; 
top:300px; 
left:45%; 

}​​ 
+0

是的,這個解決方案工作!大!! – user3760026