DIV图像不会在Firefox中显示

时间:2014-06-20 12:07:26

标签: html css firefox

我的网页中有两个动画.gif图像,但它们没有在Firefox中显示。它适用于IE,Safari和Chrome。我已阅读其他帖子,但我找不到有效的解决方案。有人可以帮忙吗?

这是网址: 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>

         

3 个答案:

答案 0 :(得分: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 :(得分:0)

试试这个:

您为加载背景图片设置的

内容: css属性正在创建问题,因此只需将 background-image 替换为给定的类 div.soon div.lokalbericht

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

取代:

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

我希望这可以帮助你!!

答案 2 :(得分:0)

Firefox不支持内容属性与Chrome相同 - 在img元素上和/或源是图像时。

所以你需要使用background属性而不是内容,或者你需要使用:before property之类的类。

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

}​​