Last active
July 12, 2016 01:32
-
-
Save BigAB/1571951 to your computer and use it in GitHub Desktop.
Body 100% height when content has margin problem
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
/** | |
* Body 100% height when content has margin problem | |
*/ | |
html, body { | |
position: relative; | |
min-height: 100%; | |
background: yellow; | |
margin: 0; | |
padding: 0.1px; /* needed to prevent the margin problem */ | |
box-sizing: border-box; | |
} | |
html { | |
height: 100%; | |
background: blue; | |
} | |
.demo { | |
background: #f06; | |
background: linear-gradient(45deg, #f06, yellow); | |
height:1000px; | |
margin: 1em; | |
} |
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="just a little demo div"></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","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment