我有一个<form>,在这个表单中,我有一个<table>。我尝试在该表单上使用text-align: center和align-items:center,但其中的表仍然左对齐(而表的子元素与表中的中心对齐)。如何在表单中将表格居中对齐?
发布于 2014-12-30 09:38:21
当你想要在父表的中心位置对齐一个表时,只需使用:
css:
margin: 0 auto;示例:
html:
<form >
<table>
</table>
</form>css:
form {
width:80%;
height: 200px;
background-color: black;
}
table {
margin: 0 auto;
z-index: 1;
width:50%;
height: 50px;
background-color: red;
}https://stackoverflow.com/questions/27698370
复制相似问题