<table>, <tr>, <td>, <th> Tags — HTML Technical Interview Questions & Answers
The building blocks of an HTML table.
<table>, <tr>, <td>, <th> Tags
- The building blocks of an HTML table.
- <table> is rows and columns of data. HTML uses this tag so the browser (and screen readers) know what the piece is, not only how it looks.
- Board: <table><tr><th>Name</th></tr></table> Put it in body. Check it in the browser. Attributes go on the opening tag.
- Trap: tables for page layout. CSS can still style it — don’t pick a tag only because of default italics.
- Interview: name the tag, one attribute if it has a famous one (href, src, alt, for, type), one mistake.
Technical Interview Tip: <table>: rows and columns of data. Example: <table><tr><th>Name</th></tr></table>
Code Examples for <table>, <tr>, <td>, <th> Tags
<table>, <tr>, <td>, <th> Tags — working example
<table>
<caption>Team roster</caption>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Role</th>
</tr>
</thead>
<tbody>
<tr><td>Ada</td><td>Engineer</td></tr>
<tr><td>Lin</td><td>Designer</td></tr>
</tbody>
</table><table>, <tr>, <td>, <th> Tags — use caption, thead/tbody, and scope on th for structure and screen readers.
How to Explain <table>, <tr>, <td>, <th> Tags to an Interviewer
What is the <table> tag?
rows and columns of data <table><tr><th>Name</th></tr></table>
One common mistake?
tables for page layout