2015-01-13 63 views
0

现在,它在调整大小时保持与页面向右滚动。我希望它在调整大小时保持不变。我把它放在一个codepen中,这样会更容易理解。出于某种原因,包含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"; 
} 

回答

0

摆脱margin: auto;这是造成#contents .add元件中心本身当视比1600像素大。

+0

这似乎工作!谢谢! – Potatoe