我选择Twitter Bootstrap来快速构建应用程序显示层,最近我遇到了问题。
我试图将元素推到页面容器的底部,但保持其居中。添加班级.push-to-bottom { position: absolute; bottom: 50px }
没有帮助。
如果您知道要居中的元素的尺寸,则可以使用 margin-left 为 width / 2 的负值。就像这样jsFiddle 示例 http://jsfiddle.net/thiagobraga/pwVLt/:
.push-to-bottom {
position: absolute;
bottom: 50px;
left: 50%;
margin-left: -50px;
}
#element {
background-color: #000;
width: 100px;
height: 100px;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)