Last active
July 30, 2021 00:42
-
-
Save hugohabel/794c4027f0cd76b07a95accf6da58a75 to your computer and use it in GitHub Desktop.
Basics of Flexbox
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> | |
<style> | |
/* Additional Styles */ | |
* { | |
box-sizing: border-box; | |
} | |
.icon { | |
border-radius: 8px; | |
padding: 16px 24px; | |
cursor: pointer; | |
} | |
.icon:hover { | |
} | |
.icon > h2 { | |
font-size: 16px; | |
margin: 8px 0; | |
color: #FCFCFC; | |
} | |
.bg-1 { | |
background: #86DBC9; | |
} | |
.bg-2 { | |
background: #4B4E6B; | |
} | |
.bg-3 { | |
background: #F3AC4A; | |
} | |
.icon-logo { | |
width: 32px; | |
} | |
.attribution { | |
margin-top: 16px; | |
text-align: center; | |
} | |
/* End Additional Styles */ | |
/* Flexbox Styles - Demo */ | |
.container { | |
display: flex; | |
justify-content: space-around; | |
/* flex-direction: column; */ | |
/* height: 50vh; */ | |
} | |
.box { | |
align-items: center; | |
display: flex; | |
flex-direction: column; | |
flex-basis: 96px; | |
} | |
.box-1 { | |
order: 3; | |
} | |
.box-2 { | |
order: 2; | |
} | |
.box-3 { | |
order: 1; | |
} | |
/* End Flexbox Styles - Demo */ | |
</style> | |
</head> | |
<body> | |
<!-- Main Container --> | |
<div class="container"> | |
<!-- Box 1 --> | |
<div class="box box-1 icon bg-1"> | |
<img src="static/cargo-ship.png" class="icon-logo"/> | |
<h2>Cargo</h2> | |
</div> | |
<!-- End Box 1 --> | |
<!-- Box 2 --> | |
<div class="box box-2 icon bg-2"> | |
<img src="static/compass.png" class="icon-logo"/> | |
<h2>Compass</h2> | |
</div> | |
<!-- End Box 2 --> | |
<!-- Box 3 --> | |
<div class="box box-3 icon bg-3"> | |
<img src="static/hook.png" class="icon-logo"/> | |
<h2>Hook</h2> | |
</div> | |
<!-- End Box 3 --> | |
</div> | |
<!-- End Main Container --> | |
<!-- Attribution --> | |
<div class="attribution"> | |
Icons made by <a href="https://www.freepik.com" title="Freepik">Freepik</a> | |
from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a> | |
</div> | |
<!-- End Attribution --> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample output of this gist
Flexbox tips & tricks: