【发布时间】:2014-06-02 10:47:20
【问题描述】:
希望对象从顶部 0px 和左侧 0px 开始,一直到右侧: http://imgur.com/A76ymUQ
我在上面展示过。 这是它的html代码和css代码:
<div id="page">
<h1 id="header"></h1>
</div>
-------------------------------------------------------------
body {
background-image:url(../img/b_webclient_1.png);
background-position: center center fixed;
background-repeat: no-repeat;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
div #header {
background-image:url(../img/webclient_header.png);
min-height: 100px;
width: auto;
margin:; /* If you want no margin */
padding:; /*if your want to padding */
background-repeat: no-repeat;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
【问题讨论】:
-
大多数浏览器的默认
body边距为8px...尝试在上面的正文中添加margin:0;。 -
这就是它没有帮助的问题。
-
啊,是的,
h1标签也有边距。试试这个:body,html,h1 {margin:0;padding:0;} -
谢谢!它工作 henryaaron
标签: html css background-image positioning