In this lesson we will discuss how to enter tables and comments in HTML.
Insert table:
To insert table in the HTML the following tags are used:
- <table> </table>: Table tag to insert table.
- <thread></thread>: The is used to create the table heading.
- <th></th>: Inside the tag, we may write what heading we want to give.
- <tr> </tr>: Table row tag for how many rows we want to insert.
- <td> </td>: Table data tag for how many columns we want to insert.
<table border = "1">
Table Styling:
Border is the attribute of table tag and 1 is the pixels or border type.
For making the border more solid we may write:
For Inline CSS:
<table border = "1" style = "border : solid ; ">
For Internal CSS:
table{
border: 1px solid black
}
To learn CSS , please click here
Look at the Example below:
<!DOCTYPE html>
<html>
<head>
<title>Inserting table</title>
</head>
<br>
<body>
<H1>HTML Table</H1>
<table border = "3" style="border : solid ;">
<thread>
<th>Name</th><th>Roll no</th>
</thread>
<tr>
<td>Farwah</td><td>19SW56</td>
</tr>
<tr>
<td>Saba</td><td>19SW53</td>
</tr>
</table>
</body>
<html>
Using Internal CSS:
<!DOCTYPE html>
<html>
<head>
<title>Inserting table</title>
<style type="text/css">
table{
border : 3px solid black
}
td{
border: 1px solid black
}
</style>
</head>
<br>
<body>
<H1>HTML Table</H1>
<thread>
<th>Name</th><th>Roll no</th>
</thread>
<tr>
<td>Farwah</td><td>19SW56</td>
</tr>
<tr>
<td>Saba</td><td>19SW53</td>
</tr>
</table>
</body>
<html>
0 Comments