HTML Table
The HTML Tables are created using the <table> tag with the help <tr> tag and <td> tag. <tr> tag is used to create a rows in HTML table and <td> tag is used to create a columns in HTML table. Table heading can be define using <th> tag.
Example:-
without border or heading.
<!DOCTYPE html>
<html>
<head>
<title>HTML Table</title>
</head>
<body>
<table>
<tr>
<td>Row 1, Column 1</td>
<td>Row 1, Column 2</td>
</tr>
<tr>
<td>Row 2, Column 1</td>
<td>Row 2, Column 2</td>
</tr>
</table>
</body>
</html>
<html>
<head>
<title>HTML Table</title>
</head>
<body>
<table>
<tr>
<td>Row 1, Column 1</td>
<td>Row 1, Column 2</td>
</tr>
<tr>
<td>Row 2, Column 1</td>
<td>Row 2, Column 2</td>
</tr>
</table>
</body>
</html>
Output:-
Row 1, Column 1 | Row 1, Column 2 |
Row 2, Column 1 | Row 2, Column 2 |
Table Heading or Border:-
Table heading can be define using <th> tag. Border size add inside table tag . For Example <table border="1">.
Example:-
<!DOCTYPE html>
<html>
<head>
<title>HTML Table</title>
</head>
<body>
<table border="1">
<tr>
<th>Neme</th>
<th>Age</th>
</tr>
<tr>
<td>Raj</td>
<td>35</td>
</tr>
<tr>
<td>Ram</td>
<td>29</td>
</tr>
</table>
</body>
</html>
Output:-
No comments:
Please do not enter any spam link in the comment box.