define a table in html
Answers
Answer:
Tables are used to arrange information uniquely. There will be no duplication of data that is inserted in the table. Now in HTML to create a table we have a tag that is <table> tag. Now to properly create the structure of the table, some tags are required like caption, table row tag, table data tag, the table header tag, and more.
For Example
Here is a code:-
<!DOCTYPE html>
<html>
<head>
<title>
HTML table
</title>
</head>
<body>
<!-- cell spacing is used to specify between the cell and its contents-->
<!-- cell padding is used to specify the space between the border of the cell and its contents-->
<table bgcolor="aqua" align="center" cellspacing="6" cellpadding="6">
<!-- TR is used to create row in the table-->
<tr bgcolor="orange">
<caption align="top">
<h1 style="color:red">
Marks
</h1>
</caption>
<th bgcolor="purple">S.no</th>
<th bgcolor="purple">Name</th>
<th bgcolor="purple">Total Marks</th>
<th bgcolor="purple">Pass or Fail</th>
</tr>
<tr>
<td>1</td>
<td>sss</td>
<td>546</td>
<td>pass</td>
</tr>
</table>
The output of the code:- we will see the table which contains the information that has been provided with certain colors and spaces given as an attribute.