How to Create a Table in HTML

In this article, you will learn How to Create a Table in HTML and CSS. In HTML table defined with the <table> tag. Every row is defined with the <tr> tag in HTML table. In the table, the header is defined with the <th> tag. It will look likes the heading. Table data is defined with the <td> tag.

Example:-

<html>
<head>
<title>Table</title>
</head>
<body>
<table>
<tr>
<th>Roll No.</th><th>Name</th><th>Class</th><th>Gender</th><th>City</th>
</tr>
<tr>
<td>124</td><td>Amandeep Singh</td><td>BCA</td><td>Male</td><td>Amritsar</td>
</tr>
<tr>
<td>136</td><td>Nisha Sharma</td><td>MCA</td><td>Female</td><td>Patiala</td>
</tr>
</table>
</body>
</html>

If we will do not define the border than the border will not display. we can define the border in css.

table{
border: 1px solid;
}
th{
border: 1px solid;
}
td{
border: 1px solid;
}

You may like this:-How to use Iframe in HTML

Check on Facebook

Leave A Reply