A Pen by Flavio De Stefano on CodePen.
Created
February 17, 2014 15:50
-
-
Save kopiro/9053050 to your computer and use it in GitHub Desktop.
A Pen by Flavio De Stefano.
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 id="bgcover" style="background-image:url(http://lorempixel.com/640/1010/city/4)"> | |
<img src="http://lorempixel.com/640/1010/city/4" /> | |
</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
#bgcover { | |
width: 1000px; | |
height: 400px; | |
background-size: cover; | |
background-position: center; | |
position: relative; | |
} | |
#bgcover > img { | |
position: absolute; | |
display: block; | |
width: 100%; | |
height: 100%; | |
left: 0; right: 0; bottom: 0; top: 0; | |
opacity: 0; /* here's the trick */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment