Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Flex centering
/**
* Flex centering
*/
body {
display: flex;
border: outset blue;
margin: 0;
text-align: center;
height: 100vh;
box-sizing: border-box;
}
main {
border: outset lime;
margin: auto;
}
<!-- content to be placed inside <body>…</body> -->
<body>
<main>
<h1>Hello world!</h1>
<section>
<h2>First Section</h2>
<p>This is the first paragraph of this document.</p>
</section>
</main>
</body>
// alert('Hello world!');
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment