关于 css 布局:
#container{
width:979px;
height:590px;
margin-left:auto; //works
margin-right:auto; //works
margin-top:auto; //doesn't work
margin-bottom:auto; //doesn't work
}
因此,我希望将#container 放置在屏幕中央。
我也试过:margin:auto - 没有结果。
最佳答案
比如:
#container{
width:979px;
height:590px;
position:absolute;
left:50%;
top:50%;
margin:-295px 0 0 -490px;
}
关于html - 将 div 放置在屏幕中央的 CSS 布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11582231/