Skip to content

Instantly share code, notes, and snippets.

@zeraphie
Created July 1, 2016 13:13
Show Gist options
  • Save zeraphie/2f563d326089f8d2094a848b46e04f84 to your computer and use it in GitHub Desktop.
Save zeraphie/2f563d326089f8d2094a848b46e04f84 to your computer and use it in GitHub Desktop.
CSS Only solution to highlighting the current row and column
table {
float: left;
overflow: hidden;
position: relative;
width: 100%;
z-index: 2;
}
table tr {
-webkit-transition: background-color 0.3s;
transition: background-color 0.3s;
}
table td {
// Comment this if you want to have the full row and column highlighted
// instead of just the row th and column th
background-color: #FFFFFF;
}
table td:after {
content: '';
height: 10000px;
left: 0;
position: absolute;
top: -5000px;
-webkit-transition: background-color 0.3s;
transition: background-color 0.3s;
width: 100%;
z-index: -1;
}
table tr:hover,
table td:hover:after,
table td:hover {
background-color: rgba(0,0,0,0.125);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment