【发布时间】:2018-01-02 00:31:55
【问题描述】:
我的问题是,我怎样才能用不同的列数量创建一行? 例如,我想在这张图片的最后一行有 2 列(每个单元格的部分必须是 50%)。 我的另一个问题是,如何使文本从单元格中的第一行开始(中心单元格,在这张图片中)?
我的代码是:
table {
border: 1px solid black;
border-collapse: collapse;
border-spacing: 5px;
}
th,
td {
padding: 10px;
}
<table style="width:100%" border="1px" cellpadding="5" cellspacing="5" bordercolor="green" bgcolor="yellow" height="500px">
<caption>web design homework</caption>
<tr>
<th colspan="3">My Website</th>
</tr>
<tr bgcolor="#77E022" height="20px" align="left">
<td colspan="3">
<a href="www.google.com" style="text-decoration:none">home</a> <a href="www.google.com" style="text-decoration:none">products</a> <a href="www.google.com" style="text-decoration:none">contact us</a>
</td>
</tr>
<tr>
<td width="25%">last post</td>
<td rowspan="2" width="50%">hello my name is mohammad ghorbani and i am studying computer enginerring in arak</td>
<td>our friends</td>
</tr>
<tr>
<td>our statics</td>
<td>24</td>
</tr>
<tr>
<td>our social pages</td>
<td>about us</td>
</tr>
</table>
【问题讨论】:
-
因为这是家庭作业,也不是那么难,你只需要花一些精力来了解表格和元素。如果我们为您做,您将永远无法了解它是如何工作的。此外,这里的人们会花时间帮助您解决其他问题,您至少应该给他们一个分数,选择他们的答案作为已接受的答案。
标签: html html-table cell