如何将这四个按钮垂直和水平居中放置在自己的div内?两个div内的垂直中心元素
更新:请勿使用Flexbox。我没有那种奢侈。
#outer {
width: 400px;
height: 200px;
background-color: black;
display: table-cell;
}
#innerOne {
width: 400px;
height: 100px;
background-color: red;
vertical-align: middle;
}
#innerOne {
width: 400px;
height: 100px;
background-color: blue;
vertical-align: middle;
}
<div id="outer">
<div id="innerOne">
<button>One</button>
<button>Two</button>
</div>
<div id="innerTwo">
<button>Three</button>
<button>Four</button>
</div>
</div>
我想 “一”, “二” 蓝格内的垂直和水平居中。黑色格中的“三”和“四”相同。
我已经尝试了很多不同的选项,通过将它们的显示设置为表格和表格单元而没有我想要的效果。