Created
March 9, 2014 16:50
-
-
Save motiteux/9450631 to your computer and use it in GitHub Desktop.
How to force HTML background to bottom when page is smaller than window (SO)
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
/** | |
* How to force HTML background to bottom when page is smaller than window (SO) | |
* http://stackoverflow.com/questions/12444774/how-to-force-html-background-to-bottom-when-page-is-smaller-than-window | |
*/ | |
html, body { | |
height: 100%; | |
/* The html and body elements cannot have any padding or margin. */ | |
background: url(http://upload.wikimedia.org/wikipedia/commons/2/22/Turkish_Van_Cat.jpg) no-repeat center center fixed; | |
-webkit-background-size: cover; | |
-moz-background-size: cover; | |
-o-background-size: cover; | |
background-size: cover; | |
} | |
body { | |
color: #fff; | |
text-align: center; | |
text-shadow: 0 1px 3px rgba(0, 0, 0, .5); | |
box-shadow: inset 0 0 100px rgba(0, 0, 0, .5); | |
-webkit-font-smoothing: antialiased; | |
-webkit-overflow-scrolling: touch; | |
} | |
.content { color: white; } |
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
<!-- content to be placed inside <body>…</body> --> | |
<div class='content'></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":"80","seethrough":"","prefixfree":"1","page":"css"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment