codegurukool.com · Free coding tutorials & online compiler

Home › HTML Tutorial › HTML tables

HTML tables

Rows, cells, headers and spans.

tr is a row, th a header cell and td a data cell. Use thead, tbody, colspan and rowspan for structure.

Example code

<style>td,th{border:1px solid #888;padding:6px}table{border-collapse:collapse}</style>
<table>
<thead><tr><th>Item</th><th colspan='2'>Price</th></tr></thead>
<tbody><tr><td>Pen</td><td>2</td><td>USD</td></tr></tbody>
</table>'

Run this code in the online editor

← Page title and faviconBlock, inline and div →