Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save achudars/5488062 to your computer and use it in GitHub Desktop.
Save achudars/5488062 to your computer and use it in GitHub Desktop.
Perfectly centered FLEXBOX using CSS with a 10% margin. Perfectly centred FLEXBOX using CSS with a 10% margin.
body {
position: absolute;
background-color: #333333;
bottom:0;
top:0;
right:0;
left: 0;
}
#blueDiv {
position:absolute;
bottom:10%;
top:10%;
right:10%;
left: 10%;
background-color: #333333;
display: -webkit-box;
-webkit-box-align: center;
-webkit-box-pack: center;
display: -moz-box;
-moz-box-align: center;
-moz-box-pack: center;
display: -ms-flexbox;
-ms-flex-align: center;
-ms-flex-pack: center;
display: box;
box-align: center;
box-pack: center;
background-color: #3399FF;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment