Created
May 8, 2021 02:29
-
-
Save justin-lyon/f55b8366acc8de5de23de5207fc937ec to your computer and use it in GitHub Desktop.
align center using flex
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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
<style> | |
html, | |
body { | |
margin: 0; | |
padding: 0; | |
font-size: 10px; | |
line-height: 1.1rem; | |
} | |
.container { | |
margin: 0 10vh; | |
} | |
.grid { | |
display: flex; | |
justify-content: center; | |
} | |
.box { | |
/* the Boxes are just a visual aid */ | |
height: 3.1rem; | |
width: 4rem; | |
background-color: yellow; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="container"> | |
<div class="grid"> | |
<div class="box"></div> | |
<div> | |
<p> | |
Lorem ipsum dolor sit amet consectetur adipisicing elit. Architecto recusandae sequi eligendi sapiente temporibus, quasi nostrum enim laboriosam ullam ab. | |
</p> | |
</div> | |
<div class="box"></div> | |
</div> | |
</div> | |
</body> | |
</html> |
Author
justin-lyon
commented
May 8, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment