Flexbox Vehicle Inventory

HTML
<main role="main"> <ul class="flexgrid columns-news"> <li> <a href="#"> <span class="grid-number">2017</span> <figure> <img src="http://i.imgur.com/ZmaytkE.jpg" alt="Cadillac CTS Sedan"> <figcaption> <p>New</p> <h2>2017 Cadillac CTS Sedan Luxury RWD</h2> <span class="mileage">28</span> <span class="stock">0349781</span> <span class="price">$53,415</span> </figcaption> </figure> </a> </li> <li> <span class="grid-number">2016</span> <span class="ribbon icon"> <a href="#" title="Cadillac CTS Sedan">✩</a> </span> <a href="#"> <figure> <img src="http://i.imgur.com/wLVxdtL.jpg" alt="Cadillac CTS Sedan"> <figcaption> <p>New</p> <h2>2016 Cadillac CTS Sedan Luxury Collection RWD</h2> <span class="mileage">32</span> <span class="stock">0349781</span> <span class="price">$53,415</span> </figcaption> </figure> </a> </li> <li> <span class="ribbon"> <a href="#" title="Rate">— $5,000</a> </span> <a href="#"> <figure> <img src="http://i.imgur.com/9iSlQa2.jpg" alt="Cadillac CTS Sedan"> <figcaption> <p> New </p> <h2>2016 Cadillac CTS Sedan RWD</h2> <span class="mileage">11</span> <span class="stock">0349781</span> <span class="price">$46,780</span> </figcaption> </figure> </a> </li> <li> <span class="ribbon"> <a title="Category" href="#">Special</a> </span> <a href="#"> <figure> <img src="http://i.imgur.com/WjTwI3f.jpg" alt="Cadillac CTS Sedan"> <figcaption> <p> New </p> <h2>2016 Cadillac CTS Sedan Luxury Collection RWD</h2> <span class="mileage">8</span> <span class="stock">0349781</span> <span class="price">$55,000</span> </figcaption> </figure> </a> </li> <li> <a href="#"> <span class="grid-number">2016</span> <figure> <img src="http://i.imgur.com/V9GkQi7.jpg" alt="Cadillac CTS Sedan"> <figcaption> <p>New</p> <h2>2016 Cadillac CTS Sedan Luxury Collection RWD</h2> <span class="mileage">12</span> <span class="stock">0349781</span> <span class="price">$47,170</span> </figcaption> </figure> </a> </li> <li> <span class="grid-number">2015</span> <span class="ribbon icon"> <a href="#" title="Cadillac CTS Sedan">✩</a> </span> <a href="#"> <figure> <img src="http://i.imgur.com/37kiFO5.jpg" alt="Cadillac CTS Sedan"> <figcaption> <p>New</p> <h2>2015 Cadillac CTS Sedan Performance RWD</h2> <span class="mileage">17</span> <span class="stock">0349781</span> <span class="price">$61,860</span> </figcaption> </figure> </a> </li> <li> <span class="ribbon"> <a href="#" title="Rate">— $5,000</a> </span> <a href="#"> <figure> <img src="http://i.imgur.com/HO8J19g.jpg" alt="Cadillac CTS Sedan"> <figcaption> <p>New</p> <h2>2016 Cadillac CTS Sedan Luxury Collection RWD</h2> <span class="mileage">10</span> <span class="stock">0349781</span> <span class="price">$53,500</span> </figcaption> </figure> </a> </li> <li> <span class="ribbon"> <a title="Category" href="#">Special</a> </span> <a href="#"> <figure> <img src="http://i.imgur.com/WcpfPfj.jpg" alt="Cadillac CTS Sedan"> <figcaption> <p> New </p> <h2>2015 Cadillac CTS Sedan RWD</h2> <span class="mileage">45</span> <span class="stock">0349781</span> <span class="price">$50,740</span> </figcaption> </figure> </a> </li> </ul> </main>
CSS
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic); html { box-sizing: border-box; } *, *:before, *:after { box-sizing: inherit; } html, body { font-family: "Open Sans","Roboto",helvetica, arial, sans-serif; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; font-size: 62.5%; padding-top: 40px; } body { background: #f4f5f6; color: #333; } a { text-decoration: none; color:#67c; } p, li, time { font-size: 1.6rem; line-height: 3.6rem; margin: 0 0 2.4rem; } h2 { font-size: 2.4rem; line-height: 3.6rem; font-weight: 400; margin: 2.4rem 0; } img { border: 0; height: auto; max-width: 100%; } figure:hover img { filter: alpha(opacity=9000); opacity: 0.90; filter: alpha(opacity=90); } figure { margin: 0; line-height: 0; } article, figure, footer, header, main { display: block; } header:before, header:after, main:before, main:after { content: ""; display: table; } header:after, main:after { clear: both; } main { position: relative; width: 1200px; max-width: 90%; margin: 0 auto; } /*================================= AUTO ADJUST / EQUAL HEIGHT =================================*/ .flexgrid { margin: 0 auto; padding: 0; display: -webkit-flex; display: flex; flex-wrap: wrap; } .flexgrid li { position: relative; list-style: none; display: -webkit-flex; display: flex; margin: 0; flex: auto; width: 100%; } .flexgrid li>a { position: relative; padding: 2.4rem; width: 100%; -webkit-flex-direction: column; flex-direction: column; } @media (min-width:768px) { .flexgrid li { width: 33.333%; } } .flexgrid li h2,.flexgrid li h3 { margin: 0; } /*================================= GRID =================================*/ .flexgrid.columns-news li { margin-bottom: 4.8rem; } .flexgrid.columns-news li a { padding: 0; } .flexgrid.columns-news li figcaption { position: relative; z-index: 9999; } .flexgrid.columns-news li p { margin: -3.6rem 0 0; padding: 0 1.2rem; font-size: .7em; text-transform: uppercase; } .flexgrid.columns-news li h2 { padding: 1.2rem; font-size: 1.6rem; line-height: 2.4rem; font-weight: 700; } /* .columns-news li:hover { transition: all 500ms cubic-bezier(0.19, 1, 0.22, 1); -webkit-transform: translateY(-2px); -moz-transform: translateY(-2px); -o-transform: translateY(-2px); -ms-transform: translateY(-2px); transform: translateY(-2px); } */ @media (min-width:568px) { .flexgrid.columns-news { margin: 0 -2%; } .flexgrid.columns-news li { margin-right:2%;margin-left: 2%; width: 46%; } } @media (min-width:1024px) { .flexgrid.columns-news li { width: 21%; } } /*================================= FAVORITE/SAVE =================================*/ .ribbon.icon { font-size:2.4rem; } /*================================= NUMBER: MOST POPULAR =================================*/ .grid-number { position: absolute; top: 1.2rem; left: 1.2rem; line-height: 1; font-weight: 600; z-index: 9999; padding: .6rem 1.2rem; border-radius: 50%; } /*================================= RIBBON =================================*/ .ribbon { position: absolute; top: 0; right: -1.3rem; padding: .6rem 1.2rem; font-size: 1.4rem; line-height: 2.4rem; text-align: center; z-index: 9999; letter-spacing: 1px; } .ribbon:before { position: absolute; right: .3rem; bottom: -1rem; border: solid transparent; content: " "; height: 0; width: 0; pointer-events: none; border-width: 10px; -ms-transform: rotate(135deg); -webkit-transform: rotate(135deg); transform: rotate(135deg); } /*================================= COLORS =================================*/ .flexgrid.columns-news li { background: #fff; border: 1px solid #eee; border-bottom: 1px solid #eee; } .flexgrid.columns-news li a { color: inherit; } .columns-news li:hover { box-shadow: 0 6px 12px rgba(0, 0, 0, 0.05); } .flexgrid.columns-news li p { color: #fff; text-shadow: 0 1px 0 #000; background: -moz-linear-gradient(top, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.4) 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(0, 0, 0, 0)), color-stop(100%, rgba(0, 0, 0, 0.4))); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(top, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.4) 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(top, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.4) 100%); /* Opera 11.10+ */ background: -ms-linear-gradient(top, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.4) 100%); /* IE10+ */ background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.4) 100%); /* W3C */ } .grid-number { background: rgba(0, 0, 0, 0.4); color: #fff; border: none; } .ribbon { background: #FFBE00; } .ribbon, .ribbon a { color: #fff; } .ribbon:before { border-color: rgba(136, 183, 213, 0); border-top-color: #ccc; } .price { font-size: 1.5em; font-weight: 700; line-height: 1.2em; padding-left: .5em; padding: 0 0 .5em .5em; color: #333; display: block; } .mileage, .stock { font-size: .8em; font-weight: normal; line-height: 2em; padding-left: 1em; color: #333; display: block; } .price:before { content: 'Our Price: '; font-weight: normal; font-size: .6em; display: block; } figure:hover:after { color: #333; border-color: #333; } figure:after { content: 'View More'; font-weight: normal; font-size: 1em; display: inline-block; right: 1em; line-height: 2em; height: 2.5em; bottom: 1em; padding: .2em .4em; border: .1em solid; border-color: #D4D2D3; color: #D4D2D3; position: absolute; } figure:hover .price:after { color: #333; border: .1em solid #333; } .mileage:before { content: 'Mileage: '; font-weight: 700; } .stock:before { content: 'Stock #: '; font-weight: 700; }
JAVASCRIPT
Expand for more options Login