tr – table row
<tr><td>…</td><td>…</td></tr>
A row of a table. It contains cells – header cells th and data cells td. The number of columns is determined by the cells (cells joined with colspan count by their width).
- Default display:
display: table-row - End tag: can be omitted – the row is ended by another
tror by the end of the group - Content: cells
tdandth - Where it can be used:
thead,tbody,tfoot(or directlytable– the browser addstbody) - DOM interface:
HTMLTableRowElement
Attributes
Only global attributes (the obsolete align, valign, bgcolor are replaced by CSS).
Examples
Striped rows:
<table class="stripes"> <tr><td>Monday</td><td>310</td></tr> <tr><td>Tuesday</td><td>290</td></tr> <tr><td>Wednesday</td><td>305</td></tr> </table>
.stripes {
border-collapse: collapse;
}
.stripes tr:nth-child(odd) td {
background: #f1f8e9;
}
.stripes td {
padding: 2px 10px;
}
Things to watch out for
- A background, a border and
paddingon the row itself work only partly (a border only withborder-collapse: collapse). Styling the cells is more reliable. - In JavaScript:
tr.cells(the cells of the row),tr.rowIndex(its position in the table),tr.insertCell(),table.deleteRow(i).
Browser support
Baseline – widely available: works in all major browsers and has for a long time (since 2015 at the latest). Since version: Chrome 1, Firefox 1, Safari 1. As of October 2026 (MDN browser-compat-data).
Related:
table – table
td – table cell
th – header cell
tbody – table body