您应该摆脱top
和bottom
on .bankingDialog
,position: absolute;
也是比fixed
这种情况更好的选择。
.bankingDialog {
position: absolute;
display: none;
left: 0;
right: 0;
margin: auto;
width: 800px;
height: 500px;
padding: 1em;
z-index: 200;
background-color: #fff;
border-radius: 15px;
}
您不相关问题的答案:
看看这个jsFiddle。您正在使用不需要的段落和表格。div
用's only做你想做的事情要容易得多。
HTML
<div class="bankingDialog" id="bankingWeaponsDialog">
<div class="centerer">
<div class="bankingbuttons">Lorem Ipsum</div>
<div class="bankingbuttons">Bot #1</div>
<div class="bankingbuttons">Bot #2</div>
<div class="bankingbuttons">Bot #3</div>
<div class="bankingbuttons">Bot #4</div>
<div class="bankingbuttons">Bot #5</div>
<div class="bankingbuttons">Bot #6</div>
<div class="bankingbuttons">Bot #7</div>
<div class="bankingbuttons">Bot #8</div>
</div>
</div>
CSS
.bankingDialog {
text-align: center;
}
.centerer {
width: 600px;
margin: 0px auto;
}
.bankingDialog .bankingbuttons:first-child {
display: block;
}
.bankingDialog .bankingbuttons {
display: inline-block;
}
.bankingDialog2 {
margin: 0 auto;
width: 500px;
}