-
-
Save chriscoyier/1886753 to your computer and use it in GitHub Desktop.
pseudo element as background-size
This file contains hidden or 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
/* pseudo element as background-size */ | |
* { | |
margin: 0; | |
padding: 0; | |
} | |
p { | |
position: relative; | |
height: 400px; | |
font-size: 100px; | |
color: red; | |
} | |
p:before { | |
content: url(http://watduck.jpg.to); | |
top:0; left: 0; right: 0; | |
position: absolute; | |
display: block; | |
width: 100%; | |
z-index: -1; | |
} |
This file contains hidden or 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
<p>Why??</p> |
This file contains hidden or 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","prefixfree":"1","page":"css"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment