我有这个 CSS:
#manipulate
{
position:absolute;
width:300px;
height:300px;
background:#063;
bottom:0px;
right:25%;
}
我有这个 html:
<div id="manipulate" align="center">
</div>
我们如何将那个 div 定位在屏幕的底部中心?!?
最佳答案
如果您不习惯使用负边距,请检查一下。
HTML -
<div>
Your Text
</div>
CSS -
div {
position: fixed;
left: 50%;
bottom: 20px;
transform: translate(-50%, -50%);
margin: 0 auto;
}
当您不知道 div 的宽度时特别有用。
关于html - 如何将 div 放置在屏幕的底部中心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9383163/