Hello folks, happy to see you again. Today we will grab some basic knowledge of HTML tables. We will learn this in a Q-A manner so you can understand it easily.
Answer: As we know HTML language uses different types of tags to create elements on the web page. Here we are going to make a table with 3 columns and 3 rows.
- To create table on the webpage you have to write <table>...</table> tags.
- You can add multiple rows by adding <tr></tr> tags between <table> </table> and tags.
- To define column name you can use <th></th>.
- The <td></td> tags will be used to create a table cell and to insert data inside the table cells.
Widely used attributes of the table are cellpadding to define padding inside cells, and cellspacing to define margin between table cells.
Browser support:
Chrome |
Firefox |
IE |
Opera |
Safari |
Android |
Yes |
Yes |
Yes |
Yes |
Yes |
Yes |
Here is an example code to create a table with 3 columns and 4 rows.
<!DOCTYPE html>
<html>
<head>
<title>Describe an HTML table Tag</title>
</head>
<body>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<th>Sr.</th>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>1</td>
<td>Sarjil Shaikh</td>
<td>25</td>
</tr>
<tr>
<td>2</td>
<td>Salman Ansari</td>
<td>23</td>
</tr>
<tr>
<td>3</td>
<td>Shahnawaz Saiyed</td>
<td>26</td>
</tr>
<tr>
<td>4</td>
<td>Abdul Qadir</td>
<td>27</td>
</tr>
</table>
</body>
</html>
Output:
Hope you liked this article, please feel free to share it with others who need this.
Comments
Post a Comment