Why a Colourful Table?
A colorful table looks very impressive while writing content in a webpage. Following is an example of the Output and the Code. <Table> tag is used to create a table.
Steps to Create an HTML Script using Notepad:
If you are really interested to learn or test a HTML script, then here are the steps. There are plenty of tools to create webpages using HTML codes. But I am going to give you the most simple tool to learn HTML.The tool, you will need to use a text editor like “Notepad (for Windows).”
Steps :
- Open Notepad
- Create a New Document (copy and paste the code given below)
- Save File in HTML
- View the saved File in a Web browser
The Output
Last Name | First Name | Department |
---|---|---|
Sinha | Susmita | Commerce |
Deb | Antara | Library Science |
Dhar | Tanushree | Law |
The Code
<html>
<style>
table {
font-family: Times New Roman;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid red;
text-align: Center;
padding: 8px;
}
tr:nth-child(even) {
background-color: lightgreen;
}
</style>
<body>
<h3><Center>List of Students and Departments</Center></h3>
<table style="width:100%">
<tr>
<th>Last Name</th>
<th>First Name</th>
<th>Department</th>
</tr>
<tr>
<td>Sinha</td>
<td>Susmita</td>
<td>Commerce</td>
</tr>
<tr>
<td>Deb</td>
<td>Antara</td>
<td>Library Science</td>
</tr>
<tr>
<td>Dhar</td>
<td>Tanushree</td>
<td>Law</td>
</tr>
</table>
</body>
</html>