【发布时间】:2014-04-05 10:24:24
【问题描述】:
如何让一个按钮在div的底部和中心同时出现?
.Center {
width: 200px;
height: 200px;
background: #0088cc;
margin: auto;
padding: 2%;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
.btn-bot {
position: absolute;
bottom: 0px;
}
<div class=Center align='center'>
<button class='btn-bot'>Bottom button</button>
</div>
【问题讨论】:
-
您不应将
align用作div的属性。在 HTML5 中,div 标记上的此属性已过时:developer.mozilla.org/en-US/docs/Web/HTML/Element/div 请改用 csstext-align: center;。 -
stackoverflow.com/questions/5817233/… 是您正在寻找的答案