Last Updated: February 25, 2016
·
11.89K
· simek

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

1 Response
Add your response

great job
vietnamradio.info

over 1 year ago ·