Set 84 Practical Question

⭐ Q34 – HTML Table with Internal CSS + Hover Row Color Change

Example Code (Read Only):


<!DOCTYPE html>
<html>
<head>
<title>Table Hover</title>

<style>
table{
    border-collapse: collapse;
    width: 50%;
}

th, td{
    border: 1px solid black;
    padding: 8px;
    text-align: center;
}

th{
    background-color: lightgray;
}

tr:hover{
    background-color: red;
}
</style>

</head>
<body>

<table>
<tr>
<th>Name</th><th>Course</th><th>Marks</th>
</tr>
<tr>
<td>Amit</td><td>O Level</td><td>85</td>
</tr>
<tr>
<td>Riya</td><td>CCC</td><td>92</td>
</tr>
</table>

</body>
</html>

Write Your HTML / JavaScript Code