Skip to content

Instantly share code, notes, and snippets.

@dennisschipper
Created December 16, 2011 20:34
Show Gist options
  • Save dennisschipper/1487850 to your computer and use it in GitHub Desktop.
Save dennisschipper/1487850 to your computer and use it in GitHub Desktop.
Generic link transition
A {
-moz-transition: all .2s ease-in-out .2s;
-webkit-transition: all .2s ease-in-out .2s;
-ms-transition: all .2s ease-in-out .2s;
-o-transition: all .2s ease-in-out .2s;
transition: all .2s ease-in-out .2s;
}
A:hover {
color: #006699;
}
.hover_box, .hover_box_content {
display: block;
width: 300px;
height: 220px;
background: #fff;
}
.hover_box {
background: url('bg.png');
border-radius: 8px;
}
.hover_box_content {
border-radius: 7px; /* Slightly smaller border radius to avoid corner gaps */
opacity: 0; /* Start with the content hidden */
text-decoration: none;
/* Our transitions */
-moz-transition: all .3s ease-in-out .2s;
-webkit-transition: all .3s ease-in-out .2s;
-ms-transition: all .3s ease-in-out .2s;
-o-transition: all .3s ease-in-out .2s;
transition: all .3s ease-in-out .2s;
}
.hover_box_content:hover {
opacity: 0.85; /* Show the content */
}
.hover_box h1, .hover_box P {
color: #000;
}
.hover_box h1 {
font-size: 1.2em;
padding: 10px 20px;
}
.hover_box P {
font-size: 0.8em;
padding: 0px 20px;
padding-bottom: 10px;
}
<div class="hover_box"><!-- This will hold our image as a background -->
<a href="#" class="hover_box_content"><!-- The content container -->
<h1>Content!</h1>
<p>What a fantastic effect! Lorel ipsum dolor sit amet!</p>
</a>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment