Skip to content

Instantly share code, notes, and snippets.

@roc
Created April 27, 2012 14:52
Show Gist options
  • Save roc/2509893 to your computer and use it in GitHub Desktop.
Save roc/2509893 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 img{
display:block;
}
.img-wrapper:after {
content: '';
position: absolute;
top: 15px;
right: 15px;
bottom: 15px;
left: 15px;
margin-bottom:10px;
/*bigger than half the element is */
border-radius:350px;
box-shadow: 0 0 0 150px rgba(0,0,0,.7);
}
<div class="img-wrapper">
<img src="http://lorempixel.com/output/animals-q-c-350-350-6.jpg" />
</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