【发布时间】:2012-09-10 06:32:15
【问题描述】:
我不知道如何正确命名,但这是我的问题:
我有这个布局:
<html>
<body>
<div id="content">this is my page</div>
<div id="button">magic button</div>
</body>
</html>
css:
#button {
position: fixed;
bottom: 20px;
background-color: #f00;
padding: 5px;
left: 50%;
margin-left: 250px;
}
html, body{
height: 100%;
}
#content {
margin: 0 auto;
width: 700px;
min-height: 100%;
background-color: #eee;
}
在此处查看小提琴:http://jsfiddle.net/n6UPF/
我的页面按我的意愿工作,按钮正是我想要的位置。
但是如果我更改按钮上的文本,它的位置将不再正确。
我想将其相对于我的内容区域的右边缘“固定”放置。
这可以在纯 CSS 中完成吗?
【问题讨论】:
标签: css positioning css-position