The attributes 'colspan' and 'rowspan' in HTML are used to merge a column or row of a table together.
Example:
<!DOCTYPE html>
<html>
<head>
<title> colspan & rowspan exmaple </title>
</head>
<body>
<table border="1" width="100%">
<tr>
<td colspan="2">Row 1, cell 1</td>
<td>Row 1, cell 2</td>
</tr>
<tr>
<td>Row 2, cell 1</td>
<td>Row 2, cell 2</td>
<td>Row 2, cell 3</td>
</tr>
<tr>
<td>Row 3, cell 1</td>
<td rowspan="2">Row 3, cell 2</td>
<td>Row 3, cell 3</td>
</table>
</body>
</html>
In general, I found coding with tables a bit difficult at the start. Positioning was hard and so was making the table the right dimensions you want. But, after a bit practice a few hours, I feel more confident using them. I think I will stick to <div>'s though.
No comments:
Post a Comment