I am having this wierd problem with using html colspan. I want to know where I am going wrong.
Below is the code snippet followed by the result when you run it:
<html>
<head>
<title>Test</title>
</head>
<body>
<table width="100%" border="true">
<tr>
<td colspan=2>2 cols</td><td colspan=18>18 cols</td>
</tr>
<tr><td colspan=2>2 cols</td><td colspan=18>18 cols</td></tr>
<tr>
<td colspan=6>6 cols</td>
<td colspan=2>2 cols</td>
<td colspan=6>6 cols</td>
<td colspan=6>6 cols</td>
</tr>
<tr>
<td colspan=6>6 cols</td>
<td colspan=2>2 cols</td>
<td colspan=6>6 cols</td>
<td colspan=6>6 cols</td>
</tr>
<tr>
<td colspan=6>6 cols</td>
<td colspan=2>2 cols</td>
<td colspan=6>6 cols</td>
<td colspan=6>6 cols</td>
</tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td><td>15</td><td>16</td><td>17</td><td>18</td><td>19</td><td>20</td></tr>
</table>
</body>
</html>
I basically want divide the total width of table into 20 equal parts and then be able to have columns in the rows with a particular multiple of the equal parts.
My questions are:
- In the last row, why are cols 1, 2 so wide compared to 3, 4, 5, 6?
- In row 3, 4, 5, why is the first column not as wide as the fourth column when both are actually colspan=6?