首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >固定位置响应

固定位置响应
EN

Stack Overflow用户
提问于 2015-01-13 23:51:49
回答 1查看 33关注 0票数 0

现在,当页面调整大小时,它会继续向右滚动。我希望它在调整大小时保持不变,我把它放在代码库中,这样就更容易理解了。由于某些原因,包含p标记的div并不是固定的,而是使p标记保持对页面大小的响应。

http://codepen.io/anon/pen/XJMJWp

代码语言:javascript
复制
<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

代码语言:javascript
复制
#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";
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-01-13 23:57:45

去掉margin: auto; --当视图端口大于1600 to时,这将导致#contents .add元素对自身进行居中。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27933657

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档