gpt4 book ai didi

HTML 表格自定义单元格宽度

转载 作者:太空宇宙 更新时间:2023-11-04 06:52:24 28 4
gpt4 key购买 nike

我是 HTML 和这个网站的新手,所以我不知道如何最好地提出我的问题,但就这样吧。我正在做一个学校元素,我应该制作一个表格,在每个单元格(单选按钮、复选框、不同的字体类型等)中以及该表格的底部包含一堆与 HTML 相关的元素在最后一行,我被要求放置按钮并使每个按钮拉伸(stretch)以覆盖整个表格宽度的 1/3。我的表格总共有 5 列,因此只需将三个按钮写在一行中,最后就会留下 2 个空列空间。我试过在网上搜索答案,但我遇到的任何论坛或网站都没有与我的问题相关,所以来这里是我最后的选择。我试过将 width="33%"直接放入元素中,但它只是让整个列占整个页面的 33%,这不是我想要的。希望有人知道该怎么做,因为我完全不知所措。

<!DOCTYPE html>
<html>

<body>
<form>
<table border="1">
<tr>
<td><i><p>It's February<br>
There is a Christmas tree<br>
in the field across the way;<br>
the strength of shoulders<br>
on the back of the chair<br>
your yesterday's shirt<br>
in the corner of my bedroom,<br>
new and fresh<br>
it was not there before.<br>
and in the dim light<br>
my old mirror shows my face young.</p></i></td>

<td><input type="checkbox">Brandon<br>
<input type="checkbox">George<br>
<input type="checkbox">Sam<br>
<input type="checkbox">Emily<br>
<input type="checkbox">Sarah<br></td>

<td><input type="radio" name="name1">Harry<br>
<input type="radio" name="name1">Veronica<br>
<input type="radio" name="name1">Garry<br>
<input type="radio" name="name1">John<br>
<input type="radio" name="name1">Ivan<br></td>

<td colspan="2"><img src="mount fuji.jpg" height="200" width="200"><br>
<p style="text-align:center">Mount Fuji</p>
</td>
</tr>

<tr>
<td rowspan="2" style="font-size:60%">The book I am currently reading<br> is George Orwell's "1984". It's a<br> postapocalyptic story about a world<br> where after a great war took place<br> a faction named "The Party" took over<br> and began to impose their tyranical<br> views upon
its subjects. It follows<br> a middle-aged man named Winston as<br> he seeks to find out the truth about<br> "The Party" and if he can even escape<br> their evil grasp.</td>

<td colspan="2"><img src="toronto.jpg" height="100" width="200"></td>

<td style="text-align:center">John, Smith</td>

<td><input type="text"></td>
</tr>

<tr>
<td colspan="2"><img src="hawes.jpg" height="100" width="200"></td>

<td>The Wizard of OZ</td>

<td>
<select name="numbers">
<option value="2">2</option>
<option value="1">1</option>
<option value="4">4</option>
<option value="7">7</option>
</select>
</td>
</tr>

<input type="hidden" name="Brandon K" value="214790158">

<tr align="center">
<td align="center"><button type="button">Button1</button></td>
<td align="center"><button type="button">Button2</button></td>
<td align="center"><button type="button">Button3</button></td>
</tr>

</table>
</form>
</body>

</html>

我花了一段时间,但我终于学会了如何发布代码。

Here's what it looks like currently

最佳答案

colspan 是您要查找的属性。它使一个单元格占据多个列。

<td colspan="3">

td {
border: 1px solid black;
}
<table>
<tr>
<td>single</td>
<td>single</td>
</tr>
<tr>
<td colspan="2">double</td>
</tr>
</table>

关于HTML 表格自定义单元格宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52731411/

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