Reputation: 81
I'm wanting to do some formatting with tables and I can't seem to figure out how to equally divide the bottom row to have the same width as the top row.
I want the top row to be like 240px, and have the bottom row divided into two parts with 120px each.
Below is a image for reference:
<table>
<tbody>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
All help would be appreciated!
That is the issue that I'm having with the colspan:
<table>
<tbody>
<tr>
<td colspan="2">Content</td>
</tr>
<tr>
<td>Column 1</td>
<td>Column 2</td>
</tr>
</tbody>
</table>
Upvotes: 0
Views: 216
Reputation: 69
Use colspan attribute in the first tag and set the width of table in CSS. Here is a JSFiddle for reference. https://jsfiddle.net/6dvnafrm/
<table>
<tbody>
<tr>
<td colspan="2">test</td>
</tr>
<tr>
<td>test</td>
<td>test</td>
</tr>
</tbody>
</table>
Upvotes: 1
Reputation: 3010
Check out this:
th, td {
border: 1px solid black;
}
td{
width:240px;
}
<body>
<table>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<th> </th>
<th> </th>
</tr>
</table>
</body>
Upvotes: 1
Reputation: 81
Setting colspan="2" to the top td fixed it.
<tr colspan="2" class="footbar">
<td colspan="2"><td>
</tr>
Upvotes: 0