Can I customize table appearance?

QuestionsQuestions8 SkillsProHTML TablesOct, 22 2025
079

Yes, you can customize the appearance of tables using CSS. You can change properties such as borders, padding, background colors, and text styles. Here’s a simple example of how to customize a table with CSS:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
        table {
            width: 100%;
            border-collapse: collapse;
        }
        th, td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: left;
        }
        th {
            background-color: #f2f2f2;
            font-weight: bold;
        }
        tr:hover {
            background-color: #f5f5f5;
        }
    </style>
</head>
<body>

<table>
    <tr>
        <th>Header 1</th>
        <th>Header 2</th>
    </tr>
    <tr>
        <td>Row 1, Cell 1</td>
        <td>Row 1, Cell 2</td>
    </tr>
    <tr>
        <td>Row 2, Cell 1</td>
        <td>Row 2, Cell 2</td>
    </tr>
</table>

</body>
</html>

This example demonstrates how to style a table with borders, padding, and hover effects. You can modify the CSS properties to achieve your desired appearance.

0 Comments

no data
Be the first to share your comment!