0

如何在 IE8 中获得整页背景?它在 Firefox 和 chrome 中运行良好。我指定了一个 1000px div 的背景。但我愿意指定正文或 html 的背景。谢谢你的时间。史蒂文

<!doctype html>
<html>
<style>
html { 

}

div.whole{width="1000px";margin:0 auto;border-style:solid; border-width:0px;height:100%;padding:0px;

background: url(images/parchment.png) no-repeat center center  fixed; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;

}

html, body {
 margin: 0px;
 padding: 0px;
 border: 0px;
 height:100%;
width:100%
}

div.image{position:relative; top:50px;left:900px;width:300px; border-style:solid;border-width:0px;}



@font-face
{
font-family: myFirstFont;
src: url(pachs___.ttf);
}

div.text{position:relative;left:250px;top:-300px; font-family:myFirstFont; font-size:250%;border-style:solid;border-width:1px;
width:600px;}


</style>

<body>
<div class="whole">

    <div class="image">
    <img src="images/tran.png" width="282px" height="381px" class="tran">
    </div>
        </div>
</body>
</html>
4

1 回答 1

0

div.whole 需要在 html, body 标签下面。您没有正确构造它,因为首先出现的元素充当了第二个出现的元素的容器。即使使用 css,这也是你需要养成的习惯。您还需要指定高度,我建议使用百分比值来确保它覆盖 100%。只需将 1000px 替换为 100% 即可。如果你想要 html 和 body 的背景,你需要在它们自己的括号内指定。

于 2013-09-01T01:21:45.613 回答