HTML TUTORIALS-
HTML Table Styling Tag –
Introduction-
HTML Table Styling Tag -
- Example Of HTML table with CSS styling, including borders, padding, colors, and hover effects:-
-)✅ Example 1: Basic Styled Table-👇
<style>
table {
border-collapse: collapse;
width: 60%;
}
th, td {
border: 1px solid black;
padding: 10px;
}
th {
background-color: #f2f2f2;
}
</style>
<table>
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>Pramod</td>
<td>25</td>
</tr>
<tr>
<td>Madhu</td>
<td>30</td>
</tr>
</table>
Name | Age |
---|---|
Pramod | 25 |
Madhu | 30 |
<style>
table {
width: 70%;
border-collapse: collapse;
}
tr:nth-child(even) {
background-color: #f9f9f9;
}
tr:hover {
background-color: #d1e7dd;
}
th, td {
border: 1px solid #ccc;
padding: 12px;
text-align: center;
}
</style>
<table>
<tr>
<th>Product</th>
<th>Price</th>
</tr>
<tr>
<td>Laptop</td>
<td>$300</td>
</tr>
<tr>
<td>Mouse</td>
<td>$10</td>
</tr>
</table>
Product | Price |
---|---|
Laptop | $300 |
Mouse | $10 |
<style>
table {
width: 60%;
border-collapse: separate;
border-spacing: 0;
border: 1px solid #ddd;
border-radius: 10px;
box-shadow: 2px 2px 8px #aaa;
}
th, td {
padding: 12px;
text-align: center;
}
</style>
<table>
<tr>
<th>Course</th>
<th>Duration</th>
</tr>
<tr>
<td>HTML Basics Learning</td>
<td>3 Weeks</td>
</tr>
<tr>
<td>CSS Advanced Learningd</td>
<td>4 Weeks</td>
</tr>
</table>
Course | Duration |
---|---|
HTML Basics Learning | 3 Weeks |
CSS Advanced Learning | 4 Weeks |
Tag | Purpose |
---|---|
<table> | Defines the table |
<tr> | Table row |
<th> | Table header (bold + centered by default) |
<td> | Table data (cell content) |
<caption> | Defines a table caption |
<colgroup> | Specifies a group of one or more columns in a table for formatting |
<col> | Specifies column properties for each column within a (colgroup) element |
<thead> | Groups the header content in a table |
<tbody> | Groups the body content in a table |
-Specify a valid MRP Procedure
-Movement type 161 is not allowed