Skip to content

Instantly share code, notes, and snippets.

@LeaVerou
Created April 26, 2012 17:58
Show Gist options
  • Save LeaVerou/2501447 to your computer and use it in GitHub Desktop.
Save LeaVerou/2501447 to your computer and use it in GitHub Desktop.
Semi-transparent color masking
/**
* Semi-transparent color masking
* (answer to question)
*/
.img-wrapper {
position: relative;
float: left;
overflow: hidden;
}
.img-wrapper:after {
content: '';
position: absolute;
top: 0; right: 0; bottom: 0; left:0;
/*bigger than half the element is */
border-radius:999px;
box-shadow: 0 0 0 100px rgba(255,255,0,.5),
0 0 0 10px rgba(255,255,0,.5) inset;
}
<div class="img-wrapper">
<img src="http://placekitten.com/150/150" />
</div>
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment