A Pen by thinsoldier on CodePen.
Last active
November 29, 2018 19:40
-
-
Save thinsoldier/3dadcc717ead7fd85fb67e8bfcc7dcbb to your computer and use it in GitHub Desktop.
jere - flexbox demo
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
<div class="container-1"> | |
<div class="box big-box" style="background-image:url(https://tech-ranking.a2hosted.com/wp-content/uploads/2018/11/Minecraft-Pillager-Outpost.jpg);"> | |
<h2>Minecraft 1.14: Pillager Outpost seed</h2> | |
</div> | |
<div class="container-2"> | |
<div class="section"> | |
<div class="box" style="background-image:url(https://tech-ranking.a2hosted.com/wp-content/uploads/2018/10/Minecraft-Bamboo-Jungle-1.jpg);"> | |
<h2>Minecraft 1.14 Bamboo Jungle Seed – The first ever bamboo forest seed for 1.14!</h2></div> | |
<div class="box" style="background-image:url(https://tech-ranking.a2hosted.com/wp-content/uploads/2018/09/Minecraft-1.13-Shaders-Comparison.jpg);"> | |
<h2>Best shaders for Minecraft 1.13 Java (2018)</h2></div> | |
</div> | |
<div class="section"> | |
<div class="box" style="background-image:url(https://tech-ranking.a2hosted.com/wp-content/uploads/2018/09/Dimmer-Android-screen-than-minimum.jpg);"> | |
<h2>How to make your Android screen dimmer or darker than minimum</h2></div> | |
<div class="box" style="background-image:url(https://tech-ranking.a2hosted.com/wp-content/uploads/2018/07/The-best-Reddit-app-alternatives.jpg);"> | |
<h2>The best Reddit app alternatives of 2018 (Android)</h2></div> | |
</div> | |
</div> | |
</div> | |
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
* { box-sizing: border-box; } | |
/* wraps the entire thing */ | |
.container-1 { | |
display: flex; | |
max-width: 1170px; | |
flex-direction: column; | |
margin: 0 auto; | |
} | |
@media screen and (min-width: 360px){ | |
.section{ | |
display: flex; | |
} | |
} | |
.box { | |
flex:1; | |
min-height: 200px; | |
background-size: cover; | |
background-position: center; | |
color: white; | |
margin: 0 5px 5px 0; | |
display:flex; | |
align-items: flex-end; /* push text to the bottom */ | |
padding: 0 0 10px 10px; | |
} | |
.box:nth-child(2) { | |
/* Remove right margin on every even numbered box child*/ | |
margin-right: 0; | |
} | |
.big-box { /* enhances .box */ | |
min-height: 380px; | |
background-size: cover; | |
background-position: center; | |
} | |
.box > h2 { /* only applies to h2 that are children of .box */ | |
margin:0; | |
color:white; | |
font-weight: normal; | |
font-size: 22px; | |
} | |
@media screen and (min-width: 768px){ | |
.container-1{ | |
flex-direction: row; | |
} | |
.big-box, .container-2 { | |
flex: 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment