2015-01-13 62 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