Created
February 7, 2014 15:45
-
-
Save mateuszgachowski-snippets/8865195 to your computer and use it in GitHub Desktop.
HTML: Hover element before hack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="description" content="Test"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Test table hover</title> | |
<link rel="stylesheet" href="css/style.css"> | |
<link rel="author" href="humans.txt"> | |
<style> | |
.table .parent td { | |
height: 38px; | |
background: transparent; | |
position: relative; | |
z-index: 4; | |
} | |
.table .child { | |
position: relative; | |
display: block; | |
} | |
.table .child:before { | |
content: ' '; | |
display: none; | |
position: absolute; | |
top: -42px; | |
height: 40px; | |
width: 100%; | |
background: #ccc; | |
z-index: 3; | |
} | |
.table .parent:hover td, | |
.table .parent:hover + .child { | |
background: #ccc; | |
} | |
.table .parent:hover + .child { | |
display: block; | |
} | |
.table .child:hover { | |
background: #ccc; | |
} | |
.table .child:hover:before { | |
display: block; | |
} | |
</style> | |
</head> | |
<body> | |
<table class="table"> | |
<tr class="parent"> | |
<td>Hello I am the fucking parent</td> | |
</tr> | |
<tr class="child"> | |
<td>Testest</td> | |
</tr> | |
</table> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment