现在,当页面调整大小时,它会继续向右滚动。我希望它在调整大小时保持不变,我把它放在代码库中,这样就更容易理解了。由于某些原因,包含p标记的div并不是固定的,而是使p标记保持对页面大小的响应。
http://codepen.io/anon/pen/XJMJWp
<div id = "contents">
<div class = "add" align = "center">
<p id = "entry" style = "position: fixed;margin-left:1163px;margin-top:415px;">One</p>
</div>
</div>CSS
#contents .add{
width: 1600px;
height: 750px;
margin: auto; position: fixed; top: 0; left:0; bottom:0; right:0;
font-family: "Cedarville Cursive","Lato";
}
#contents{
width: 1600px;
height: 750px;
margin: auto; position: absolute; top: 0; left:0; bottom:0; right:0;
font-family: "Cedarville Cursive","Lato";
}发布于 2015-01-13 23:57:45
去掉margin: auto; --当视图端口大于1600 to时,这将导致#contents .add元素对自身进行居中。
https://stackoverflow.com/questions/27933657
复制相似问题