Skip to content

Instantly share code, notes, and snippets.

@nextechu
Last active January 3, 2016 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nextechu/8494116 to your computer and use it in GitHub Desktop.
Save nextechu/8494116 to your computer and use it in GitHub Desktop.
Using CSS class selector to select rows in a table and highlighting every other row.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>highlighted rows</title>
<style>
table {
border-collapse: collapse;
}
td {
padding-right: 10px;
}
.highlighted {
background-color: #ffdc87;
cursor: pointer;
}
</style>
</head>
<body>
<table>
<tr class="highlighted">
<td>1</td><td>11</td><td>111</td>
</tr>
<tr>
<td>2</td><td>22</td><td>222</td>
</tr>
<tr class="highlighted">
<td>3</td><td>33</td><td>333</td>
</tr>
<tr>
<td>4</td><td>44</td><td>444</td>
</tr>
<tr class="highlighted">
<td>5</td><td>55</td><td>555</td>
</tr>
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment