CSS3: Transparent background image using ":after"
Simple example:
.any-tag {
width: 100px;
height: 100px;
display: block;
position: relative;
}
.any-tag:after {
width: 100px;
height: 100px;
top: 0;
left: 0;
position: absolute;
z-index: -1;
content: "";
background: url(url-to-your-image);
opacity: .5;
}
Codepen Demo: http://codepen.io/Simek/pen/JfaKr
Written by Simek
Related protips
1 Response
great job
vietnamradio.info
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Css
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#