2 回答

TA貢獻(xiàn)1866條經(jīng)驗(yàn) 獲得超5個(gè)贊
我喜歡Flex Box,你可以在類似的結(jié)構(gòu)中工作
<body>
<div class="form">
<input>
...some input fields
</input>
<button>My Submit</button>
</div>
<body>
然后你的CSS
.form{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
這將使 .form div 中的所有子項(xiàng)在 .form 中垂直和水平居中,而無(wú)需指定填充或邊距

TA貢獻(xiàn)1842條經(jīng)驗(yàn) 獲得超13個(gè)贊
我想我有點(diǎn)晚了,但你可以通過(guò)以下方式做到這一點(diǎn):
tr{
height: 10px;
width:100px;
}
table{
width: 100%;
}
table, tr, td {
border: 1px solid black;
}
.container{
display: flex;
}
.tableContainer{
width:80%;
}
.submitContainer{
display: flex;
align-items: center;
justify-content: center;
width:20%;
}
<div class="container">
<div class='tableContainer'>
<table>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</div>
<div class='submitContainer'>
<button>CLick me </button>
</div>
</div>
添加回答
舉報(bào)