-
-
Save damijanc/34c084c835ef105a6de6 to your computer and use it in GitHub Desktop.
centering with absolute position
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
/** | |
* centering with absolute position | |
*/ | |
div.header { | |
width: 100%; | |
background-color:green; | |
height: 30px; | |
position:relative; | |
} | |
div.container { | |
position:relative; | |
width: 100%; | |
height: 400px; | |
} | |
div.body { | |
width: 100px; | |
height: 100px; | |
background-color: red; | |
position: absolute; | |
top:0; | |
bottom: 0; | |
left: 0; | |
right: 0; | |
margin: auto; | |
} | |
div.footer { | |
width: 100%; | |
background-color:yellow; | |
height: 30px; | |
position:relative; | |
} | |
div.impressum { | |
width: 20px; | |
background-color:blue; | |
height: 30px; | |
position:relative; | |
margin-left: 10%; | |
} |
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 class="header"></div><div class="container"><div class="body"></div></div><div class="footer"><div class="impressum"></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-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"result"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment