gpt4 book ai didi

html - 表格单元格中的文本不像标题中那样居中

转载 作者:太空宇宙 更新时间:2023-11-04 04:27:29 26 4
gpt4 key购买 nike

CSS:

.one {
width: 13%;
}

.two {
width: 30%;
}

.three {
width: 30%;
}

HTML:

<table>
<tr>
<th class= "one">Quantity</th>
<th class= "two">Info</th>
<th class= "three">Price</th>
</tr>
<tr>
<td class = "one"><input type="text" name="quantity1" value=""/>
<td class = "two">Cheap Monday Jeans 30/34 </td>
<td class = "three">$39.99 </td>
</tr>
<tr>
<td class = "one"><input type="text" name="quantity2" value=""/></td>
<td class = "two">Herschel Bag (free) </td>
<td class = "three">$129.99 </td>
</tr>
<tr>
<td class = "one"><input type="text" name="quantity3" value=""/></td>
<td class = "two">Diesel t-shirt (s) </td>
<td class = "three">$59.99 </td>
</tr>
<tr>
<td class = "one"><input type="text" name="quantity4" value=""/></td>
<td class = "two">Superdry Patrol Lite Jacket (m) </td>
<td class = "three">$129.99 </td>
</tr>
<tr>
<td class = "one"><input type="text" name="quantity5" value=""/></td>
<td class = "two">I love Canada t-shirt (s) </td>
<td class = "three">$19.99 </td>
</tr>
</table>

我希望表格行(服装信息和价格)在表格标题的正下方对齐。我不知道为什么表格行向左倾斜并且不能在标题的右下方对齐。

enter image description here

最佳答案

首先你忘记在第一次输入后关闭 td。

 <td class = "one"><input type="text" name="quantity1" value=""/></td>

你可以添加这个css让它们居中

td
{
text-align:center;
}

看看这个 EXAMPLE

关于html - 表格单元格中的文本不像标题中那样居中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17983973/

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