Skip to content

Instantly share code, notes, and snippets.

@rinatio
Created May 24, 2013 06:52
Show Gist options
  • Save rinatio/5641730 to your computer and use it in GitHub Desktop.
Save rinatio/5641730 to your computer and use it in GitHub Desktop.
Simple hover info with css
.hover-info {
$pd: 20px; // Padding
$bd: 1px; // Border width
$bdr: 8px; // Border radius
$bdc: rgba(0, 0, 0, 0.1); // Border color
$bsh: 2px 2px 2px rgba(0, 0, 0, 0.2); // Box shadow
.hover-details {
display: none;
}
&:hover {
position: relative;
background: white;
z-index: 100;
border-radius: $bdr $bdr 0 0;
border: $bd solid $bdc;
border-bottom: none;
margin: -#{$pd+$bd} -#{$pd+$bd} 0;
padding: $pd $pd 0;
box-shadow: $bsh;
.hover-details {
display: inline-block;
position: absolute;
background: white;
right: 0;
left: 0;
border-color: $bdc;
border-width: $bd;
border-style: none solid solid;
border-radius: 0 0 $bdr $bdr;
margin: 0 -#{$bd} -#{$bd};
padding: 0 $pd $pd;
box-shadow: $bsh;
}
}
// Clearfix for vertical margin collapsing
&:before,
&:after {
display: table;
line-height: 0;
content: "";
}
&:after {
clear: both;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment