I have a basic question regarding tables and columns in HTML. I would like to have two different tables on the same page but each table with a different number of columns. First table with six columns and second with only three. Now what happens is that the columns in the second table aren't centered with the ones in the first table, they're all to the left. What to do in order that the three columns in the second table take as much place as the six columns in the first table?
Here's my code, thanks for helping
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h2>title 1</h2>
<table>
<col class="number"></col>
<col class="description"></col>
<col class="reference"></col>
<col class="candidate"></col>
<col class="difference"></col>
<col class="score"></col>
<thead>
<tr>
<th>column 1</th>
<th>column 2</th>
<th>column 3</th>
<th>column 4</th>
<th>column 5</th>
<th>column 6</th>
</tr>
</thead>
</table>
<h2>title 2</h2>
<table>
<col class="number"></col>
<col class="description"></col>
<col class="diagram"></col>
<thead>
<tr>
<th colspan="2">column 1</th>
<th>column 2</th>
<th>column 3</th>
</tr>
</thead>
</table>
</body>
</html>
CSS definitions
.highlight
{
background:#f8f6f6;
}
.clicked
{
background:#c4c0c0;
}
h2
{
text-align:center;
}
body
{
font-family:Times New Roman, Georgia, Serif; font-size:14px;
}
table
{
width:100%;
font-size:14px;
table-layout:auto;
border-collapse:collapse;
background:#FFFFFF;
}
table th
{
font-weight:bold;
color:#FFFFFF;
text-align:left;
padding:7px 15px;
background:#373736;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#373736', endColorstr='#999a99');
background: -moz-linear-gradient(bottom, #999a99, #373736);
background: -webkit-gradient(linear, left bottom, left top, from(#999a99), to(#373736));
}
table td
{
vertical-align:top;
text-align:left;
padding:7px 15px;
}