gpt4 book ai didi

html - 如何对齐表格

转载 作者:行者123 更新时间:2023-11-28 16:35:44 26 4
gpt4 key购买 nike

我的网页上有一个表格,它自动向左对齐,文本居中对齐,这是我想要的,但我无法让表格与页面的中心对齐。

<table style="border: 1px solid black;  width:300px">
<tr>

<td colspan="2">
<b>&nbsp;Change Your Passwordsword</b>
</td>
</tr>
<tr>
<td>
New Password:
</td>
<td>
<input type="password" id="pwd1" name="pwd1" size = "8" />&nbsp;
</td>
<tr>
<td>
Confirm Password:
</td>
<td>

<input type="password" id="pwd2" size = "8" name="pwd2" />&nbsp;
</td>
</tr>
<tr>
<td>
</td>
<td>

<input type="submit" value="Confirm" /></td>

</tr>
<tr>
<td>
<asp:Literal ID="msg" runat="server" />
</td>
</tr>
</table>

这是我的表格的代码。

最佳答案

使用下面的 css 属性

table{
margin:auto;
}
<table style="border: 1px solid black;  width:300px">
<tr>

<td colspan="2">
<b>&nbsp;Change Your Passwordsword</b>
</td>
</tr>
<tr>
<td>
New Password:
</td>
<td>
<input type="password" id="pwd1" name="pwd1" size = "8" />&nbsp;
</td>
<tr>
<td>
Confirm Password:
</td>
<td>

<input type="password" id="pwd2" size = "8" name="pwd2" />&nbsp;
</td>
</tr>
<tr>
<td>
</td>
<td>

<input type="submit" value="Confirm" /></td>

</tr>
<tr>
<td>
<asp:Literal ID="msg" runat="server" />
</td>
</tr>
</table>

关于html - 如何对齐表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29032385/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com