How to create a table row using HTML5 ?
In this article, we define a row in a table by using a <tr> tag in a document. This tag is used to define a row in an HTML table. The tr element contains multiple th or td elements.
Syntax:
<tr> ... </tr>
Example:
<!DOCTYPE html> < html > < head > < title > How to define row of a table </ title > < style > body { text-align: center; } h1 { color: green; } th { color: blue; } table, tbody, td { border: 1px solid black; border-collapse: collapse; } </ style > </ head > < body > < center > < h1 >w3wiki</ h1 > < h2 > HTML5: How to define a row in a table? </ h2 > < table > < thead > <!-- tr tag starts here --> < tr > < th >Name</ th > < th >User Id</ th > </ tr > <!-- tr tag end here --> </ thead > < tbody > < tr > < td >Shashank</ td > < td >@shashankla</ td > </ tr > < tr > < td >w3wiki</ td > < td >@Beginner</ td > </ tr > </ tbody > </ table > </ center > </ body > </ html > |
Output:
Supported Browsers:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Safari
Contact Us