Skip to content

Instantly share code, notes, and snippets.

@taniarascia
Created July 25, 2015 04:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taniarascia/711e7ed7e9821f8fdea1 to your computer and use it in GitHub Desktop.
Save taniarascia/711e7ed7e9821f8fdea1 to your computer and use it in GitHub Desktop.
Overlay a color and opacity to a background image
.box {
width:350px;
height:150px;
}
.fade {
position: relative;
}
.fade:after {
background-color: red;
position: absolute;
top:0;
left:0;
width:100%;
height:100%;
opacity:0;
transition: opacity .25s ease-in-out;
-moz-transition: opacity .25s ease-in-out;
-webkit-transition: opacity .25s ease-in-out;
}
.fade:hover:after {
opacity: .5;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment