HTML tables allow web authors to arrange data into rows and columns.
An HTML table is defined with the<table>tag.
Each table row is defined with the <tr> tag. A table header is defined with the <th> tag. By default, table headings are bold and centered. A table data/cell is defined with the <td> tag.
Note: The <td> elements are the data containers of the table. They can contain all sorts of HTML elements; text, image, lists, other tables, etc.
To make a cell span more than one column, use the colspan attribute.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tables</tilte>
</head>
<body>
<table>
<tr><th>Name</th><th>Company</th><th>Dat of Birth</th></tr>
<tr><td>Mark Zuckerberg</td><td>Faceook</td><td>1984</td></tr>
<tr rowspan ="2"><td>Bill Gates</td><td>Microsoft</td><td>1955</td></tr>
<tr><td colspan="2">Steve Jobs</td><td>1955</td></tr>
</table>
</body>
</html>
<aside> ⚖️ Copyright © 2021 Code 4 Tomorrow. All rights reserved. The code in this course is licensed under the MIT License.
If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact [email protected] for inquiries.
</aside>