Flexbox Layout Prototype

HTML
<div class="wrapper"> <article class="story"> <div class="story__media"><a class="story__link" src="#"><img class="story__featured-image" src="https://source.unsplash.com/pmX9BkDDr_A"/> <div class="story__taxonomy">hiking</div></a></div> <header> <h2 class="story__title">Get Outside</h2> </header> <div class="story__body"> <p>Virtutis, magnitudinis animi, patientiae, fortitudinis fomentis dolor mitigari solet. An vero, inquit, quisquam potest probare, quod perceptfum, quod. Apparet statim, quae sint officia, quae actiones. Quorum altera prosunt, nocent altera. Nos paucis ad haec additis finem faciamus aliquando; Vitiosum est enim in dividendo partem in genere numerare. Omnia contraria, quos etiam insanos esse vultis. Quodcumque in mentem incideret, et quodcumque tamquam occurreret. </p> <p>Bonum valitudo: miser morbus. Cum autem in quo sapienter dicimus, id a primo rectissime dicitur. Quodcumque in mentem incideret, et quodcumque tamquam occurreret. Omnium enim rerum principia parva sunt, sed suis progressionibus usa augentur nec sine causa; Cum salvum esse flentes sui respondissent. </p> </div><a class="btn read-more" href="#">Read More</a> </article> <article class="story"> <div class="story__media"><a class="story__link" src="#"><img class="story__featured-image" src="https://source.unsplash.com/MAxHEAaAukI"/> <div class="story__taxonomy">hiking</div></a></div> <header> <h2 class="story__title">Winter Wonderland</h2> </header> <div class="story__body"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sin te auctoritas commovebat, nobisne omnibus et Platoni ipsi nescio quem illum anteponebas? Miserum hominem! Si dolor summum malum est, dici aliter non potest. Eadem nunc mea adversum te oratio est. Dat enim intervalla et relaxat. Duo Reges: constructio interrete.</p> <p>Tum ille timide vel potius verecunde: Facio, inquit. Non risu potius quam oratione eiciendum? Similiter sensus, cum accessit ad naturam, tuetur illam quidem, sed etiam se tuetur; Optime, inquam. Nihil enim iam habes, quod ad corpus referas. Quodcumque in mentem incideret, et quodcumque tamquam occurreret. Quodcumque in mentem incideret, et quodcumque tamquam occurreret.</p> </div><a class="btn read-more" href="#">Read More</a> </article> <article class="story"> <div class="story__media"><a class="story__link" src="#"><img class="story__featured-image" src="https://source.unsplash.com/Z87YuMKEiWk"/> <div class="story__taxonomy">snowshoeing</div></a></div> <header> <h2 class="story__title">The Mountains Beckon</h2> </header> <div class="story__body"> <p>Virtutis, magnitudinis animi, patientiae, fortitudinis fomentis dolor mitigari solet. An vero, inquit, quisquam potest probare, quod perceptfum, quod. Apparet statim, quae sint officia, quae actiones. Quorum altera prosunt, nocent altera. Nos paucis ad haec additis finem faciamus aliquando; Vitiosum est enim in dividendo partem in genere numerare. Omnia contraria, quos etiam insanos esse vultis. </p> <p>Bonum valitudo: miser morbus. Cum autem in quo sapienter dicimus, id a primo rectissime dicitur. Quodcumque in mentem incideret, et quodcumque tamquam occurreret. Omnium enim rerum principia parva sunt, sed suis progressionibus usa augentur nec sine causa; Cum salvum esse flentes sui respondissent.</p> </div><a class="btn read-more" href="#">Read More</a> </article> </div>
SCSS
/* Best viewed in full-screen mode! */ /* Variables */ $black: #222; $darkgray: #383737; $gray: #999; * { box-sizing: border-box; } body { font-family: 'Source Sans Pro', Arial, sans-serif; font-weight: 400; font-size: 100%; color: $black; line-height: 1.35; background: $darkgray; } h1, h2, h3 { font-weight: 900; } p { margin-bottom: 0.3em; } img { max-width: 100%; height: auto; } a { color: #000; text-decoration: none; transition: all 0.3s; &:hover { color: #000; text-decoration: none; } } .btn { background: $black; color: #fff; font-weight: 900; padding: 0.5em 0.8em; border-radius: 4%; display: inline-block; transition: all 0.3s; &:hover { color: #fff; background: $gray; text-decoration: none; } } .wrapper { max-width: 1400px; margin: 1em auto; display: flex; flex-wrap: wrap; } /* Story styles */ .story { background: #fff; margin: 1em 0.8em; flex: 1 1 500px; &:hover { .story__media:before { opacity: 1; } } @media only screen and (min-width: 800px) { flex: 1 1 300px; // For vertical alignment of "read more" buttons display: flex; flex-wrap: wrap; & > * { flex: 1 1 100%; } } @media only screen and (min-width: 1200px) { flex: 1 1 200px; } } .story__media { position: relative; overflow: hidden; cursor: pointer; &:before { content: ""; position: absolute; bottom: 5px; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.3); opacity: 0; transition: opacity 0.3s ease-in; } } .story__link { display: inline-block; } .story__title { font-size: 1.4em; } .story__taxonomy { position: absolute; bottom: 7px; left: 0; text-transform: uppercase; color: #fff; font-size: 1.1em; font-weight: 300; padding: 0.4em 0.5em; background: $black; } .story__body, .read-more { margin: 0 0.8em; } .story__body { p:last-of-type { margin-bottom: 1em; } @media only screen and (min-width: 800px) { min-height: 500px; } @media only screen and (min-width: 1200px) { min-height: 550px; } } .read-more { flex: 0 1 110px; align-self: flex-end; margin-bottom: 1.5em; } .story__title { margin: 0.2em 0 0 0.6em; }
JAVASCRIPT
Expand for more options Login