JSFiddle - React, Tailwind, and code Playground
by mackry
HTML
<ul>
<li class="promo-item first">
<div class="stretchy-wrapper">
<div>
<!-- PROMO TEMPLATE ONE: Copy from here -->
<style>
#promo-one {
background: #8bc347;
color: #fff;
font-size: 20px;
font-weight: bold;
text-align: center;
text-shadow: 0 1px 2px rgba(0,0,0,.2);
}
#promo-one img {
opacity: .2;
filter: alpha(opacity=20);
width: 100%;
}
#promo-one span {
position:absolute;
left: 0;
right: 0;
top: 25%;
}
</style>
<div id="promo-one">
<img src="http://placehold.it/200x100" alt="Onsite Health Screening" />
<span>Onsite Health Screening</span>
<!-- /END PROMO TEMPLATE ONE -->
</div>
</div>
</div>
</li>
<li class="promo-item second">
<div class="stretchy-wrapper">
<div>
<!-- PROMO TEMPLATE TWO: Copy from here -->
<style>
#promo-two span {
background-color: #444;
background-color: rgba(0,0,0,.6);
color: #fff;
font-size: 13px;
text-align: center;
text-shadow: 0 1px rgba(0,0,0,.2);
padding: 10px 0;
position: absolute;
...
CSS
body {
font-family: "Helvetica Neue", Arial, sans-serif;
margin: 50px;
}
ul {
max-width: 700px;
width: 70%;
list-style: none;
}
.promo-item > div {
background-color: #ECECEC;
overflow: hidden;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
-moz-background-clip: padding;
-webkit-background-clip: padding-box;
background-clip: padding-box;
}
.stretchy-wrapper {
padding-bottom: 50%;
position: relative;
width: 100%;
}
.stretchy-wrapper > div {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.promo-item {
background-color: white;
float: left;
margin: 0 1.2%;
padding: 5px;
position: relative;
width: 30.9%;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
-moz-background-clip: padding;
-webkit-background-clip: padding-box;
background-clip: padding-box;
-moz-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}