In CSS, you can style tables using various properties to make them more visually appealing and user-friendly. Here’s an example of how to style a basic HTML table using CSS:
HTML:
Product
Price
Quantity
Total
Product 1
$10
2
$20
Product 2
$15
3
$45
CSS:
table {
border-collapse: collapse;
width: 100%;
}
th, td {
text-align: left;
padding: 8px;
}
th {
background-color: #4CAF50;
color: white;
}
tr:nth-child(even) {
background-color: #f2f2f2;
}
This CSS applies the following styles to the table:
These are just a few examples of how to style tables in CSS. There are many other properties you can use to further customize tables, such as border styles, font sizes, and text colors.
Learners TV is a website that is designed to educate users and provide instructional material on particular subjects and topics.