如何将 table 的形式居中
How to center a table that in form at middle
我想要 table 垂直向下
我尝试使用 verticle-align:middle
但仍然没有完成工作
预期:(使用绘画编辑)
register.html
<div class='center'>
<form method='post' autocomplete="off">
<table>
<tr>
<td width='200px'>Username</td>
<td><input id='rounded' type='text' name='user'></td>
</tr>
<tr>
<td>Passwords</td>
<td><input id='rounded' type='password' name='pass'></td>
</tr>
<tr>
<td>Name</td>
<td><input id='rounded' type='text' name='name'></td>
</tr>
<tr>
<td>Email</td>
<td><input id='rounded' type='text' name='email'></td>
</tr>
<tr>
<td>No. Telephone</td>
<td><input id='rounded' type='text' name='tel'></td>
</tr>
</table><br>
<input id='button' type='submit' value='enter' formmethod='post' >
</form>
</div>
register.css
.center{
text-align: center;
}
form{
margin-left:auto;
margin-right:auto;
width: 500px;
height: 600px;
background-color: white;
border-radius: 40px;
}
table{
vertical-align: middle;
font-size: 25px;
margin-left:auto;
margin-right:auto;
}
我的方法是使用 table
的空行,但我确定 css
一定比那个好
form{
display: flex;
justify-content: center;
align-items: center;
}
我想要 table 垂直向下
我尝试使用 verticle-align:middle
但仍然没有完成工作
register.html
<div class='center'>
<form method='post' autocomplete="off">
<table>
<tr>
<td width='200px'>Username</td>
<td><input id='rounded' type='text' name='user'></td>
</tr>
<tr>
<td>Passwords</td>
<td><input id='rounded' type='password' name='pass'></td>
</tr>
<tr>
<td>Name</td>
<td><input id='rounded' type='text' name='name'></td>
</tr>
<tr>
<td>Email</td>
<td><input id='rounded' type='text' name='email'></td>
</tr>
<tr>
<td>No. Telephone</td>
<td><input id='rounded' type='text' name='tel'></td>
</tr>
</table><br>
<input id='button' type='submit' value='enter' formmethod='post' >
</form>
</div>
register.css
.center{
text-align: center;
}
form{
margin-left:auto;
margin-right:auto;
width: 500px;
height: 600px;
background-color: white;
border-radius: 40px;
}
table{
vertical-align: middle;
font-size: 25px;
margin-left:auto;
margin-right:auto;
}
我的方法是使用 table
的空行,但我确定 css
一定比那个好
form{
display: flex;
justify-content: center;
align-items: center;
}