Skip to content

Instantly share code, notes, and snippets.

@mattradford
Created August 24, 2015 10:27
Show Gist options
  • Save mattradford/4eaec9b28d187ab4e925 to your computer and use it in GitHub Desktop.
Save mattradford/4eaec9b28d187ab4e925 to your computer and use it in GitHub Desktop.
Transition on a psuedo element background
article {
.featured-image {
position: relative;
&:before {
.transition(all 0.3s ease);
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1;
content: "";
opacity: 0;
visibility: hidden;
background: url(../img/gradient.png) top left no-repeat;
background-size: cover;
}
}
&:hover, &:active {
.featured-image {
&:before {
opacity: 1;
visibility: visible;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment