Created
April 26, 2012 17:58
-
-
Save LeaVerou/2501447 to your computer and use it in GitHub Desktop.
Semi-transparent color masking
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="img-wrapper"> | |
<img src="http://placekitten.com/150/150" /> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"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