JSFiddle - React, Tailwind, and code Playground
by Darren Galway
HTML
<!--
01. Alignment & Justification
-->
<!--FLEX CENTER ROW-->
<div class="container hero flex flex-c-center flex-row">
<h1>Flex Demo</h1>
<h2>Learning Flexbox Things</h2>
<a href="#">Learn more »</a>
</div>
<!--FLEX CENTER COL-->
<!-- <div class="container hero flex flex-c-center flex-row">
<h1>Flex Demo</h1>
<h2>Learning Flexbox Things</h2>
<a href="#">Learn more »</a>
</div> -->
<!--
02. The Flex Property and how to use it in layout
-->
<!-- <div class="container hero flex flex-wrap">
<div class="col flex flex-col">
<div class="col-item flex">One</div>
<div class="col-item flex">Two</div>
<div class="col-item flex">Three</div>
</div>
<div class="col flex flex-col">
<div class="col-item flex">One</div>
<div class="col-item flex">Two</div>
<div class="col-item flex">Three</div>
</div>
<div class="col flex flex-col">
<div class="col-item flex">One</div>
<div class="col-item flex">Two</div>
<div class="col-item flex">Three</div>
</div>
</div> -->
SCSS
* {
box-sizing: border-box;
}
.container {
width: 100vw;
}
.hero {
height: 100vh;
background: lightpink;
}
// HELPERS
.col {
flex: 1;
border: 1px solid red;
}
.col-item {
flex: 1 0 auto;
border: 1px solid red;
}
.flex {
display: flex;
}
.flex-wrap {
flex-wrap: wrap;
}
.flex-v-center {
align-items: center;
}
.flex-h-center {
justify-content: center;
}
.flex-c-center {
align-items: center;
justify-content: center;
}
.flex-row {
flex-direction: row;
}
.flex-col {
flex-direction: column;
}