Reputation: 1
Here's the code:Well my problem's the grade column I want it to be two columns but I don't know how can anyone help me.
<html>
<body>
<center>
<table border=2 width=50% cellspacing=5 cellpadding=8 bgcolor=yellow cols=2>
<tr>
<td rowspan=2>Name</td>
<td>ASP</td>
</tr>
<tr>
<td>Exer</td>
<td>Quiz</td>
<td>Recitation</td>
<td>Pe</td>
<td>Me</td>
<td>Grade</td>
</tr>
<tr>
<td>Student 1<td rowspan=5> </td><td colspan=4 rowspan=5> </td><td rowspan=5> </td></tr>
<tr>
<td>Student 2</td>
</tr>
<tr>
<td>Student 3</td>
</tr><tr>
<td>Student 4</td>
</tr>
<tr>
<td>Student 5</td>
</tr>
</table>
</body>
</html>
Upvotes: 0
Views: 138
Reputation: 218798
You mean you want the "Grade" header to span two columns beneath it? Add colspan="2"
to the <td>
element for that header and add new <td>
elements to the row(s) beneath it.
<html>
<body>
<center>
<table border=2 width=50% cellspacing=5 cellpadding=8 bgcolor=yellow cols=2>
<tr>
<td rowspan=2>Name</td>
<td>ASP</td>
</tr>
<tr>
<td>Exer</td>
<td>Quiz</td>
<td>Recitation</td>
<td>Pe</td>
<td>Me</td>
<td colspan="2">Grade</td>
</tr>
<tr>
<td>Student 1<td rowspan=5> </td><td colspan=4 rowspan=5> </td><td rowspan=5> </td><td rowspan=5> </td></tr>
<tr>
<td>Student 2</td>
</tr>
<tr>
<td>Student 3</td>
</tr><tr>
<td>Student 4</td>
</tr>
<tr>
<td>Student 5</td>
</tr>
</table>
</body>
</html>
Upvotes: 1
Reputation: 62326
Refer to the "colspan and rowspan" section.
http://www.tizag.com/htmlT/tables.php
Upvotes: 0
Reputation: 73484
The td element has a colspan attribute that you can use to specify how many columns you want the td to occupy.
Upvotes: 0