Created
August 20, 2015 14:10
-
-
Save engelju/10ac4f510a7112c347c5 to your computer and use it in GitHub Desktop.
Center with Flexbox™ (http://jsbin.com/tenatijago/)
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Created on JS Bin</title> | |
</head> | |
<body> | |
<div> | |
This is a sample text. | |
</div> | |
<div class="flexbox-container"> | |
<div>1</div> | |
<div>2</div> | |
<div>2</div> | |
<div>2</div> | |
<div>2</div> | |
<div>2</div> | |
<div>2</div> | |
<div>2</div> | |
<div>2</div> | |
<div>2</div> | |
<div>2</div> | |
<div>2</div> | |
</div> | |
</body> | |
</html> |
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
.flexbox-container { | |
display: flex; | |
display: -webkit-flex; | |
flex-direction: row; | |
-webkit-flex-direction: row; | |
-webkit-flex-wrap: wrap; | |
flex-wrap: wrap; | |
justify-content: center; | |
align-items: center; | |
align-content: center; | |
position: relative; | |
min-height: 200px; | |
background: #eee; | |
border: 1px solid #999; | |
padding: 15px; | |
margin-top: 10px; | |
} | |
.flexbox-container div { | |
height: 50px; | |
width: 50px; | |
background: #16193B; | |
margin: 5px; | |
text-align: center; | |
line-height: 30px; | |
color: #fff; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment