Key Points

  • To create a table, use the <table> tag. Enclose each row in a <tr> tag, and enclose each cell in each row in a <td> tag.

  • Table size can be specified in either pixels or as a percentage of the page width. Use the width argument like this: <table width="400">.

  • You can also set width by using a style rule like this: <table style="width: 400">.

  • You can specify the width of each cell, either in percentages or pixels like this: <td width="100"> or <td style="width: 100">.

  • To merge (span) multiple cells, place the colspan or rowspan argument in the cell at the top of or farthest to the left in the range to be spanned like this: <td colspan="2">.

  • Tables can be used as containers to facilitate page layout. You can place all or part of the page’s ...

Get HTML and XHTML Step by Step now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.