JSFiddle - React, Tailwind, and code Playground
by oduska
HTML
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<div id="buy-now" class="products-section">
<div class="container">
<ul class="product-type">
<li>
<input type="radio" id="original" name="product-type" class="sr-only" checked />
<label for="original">Original, Only 40 Calories</label>
</li>
<li>
<input type="radio" id="zero-sugar" name="product-type" class="sr-only" />
<label for="zero-sugar">Zero Sugar, Only 10 Calories</label>
</li>
</ul>
<div class="products">
<form id="products-original">
<div class="row">
<div class="col som-4-pack">
<div class="inner">
<div class="image">
<img src="https://i.imgur.com/iIhjPiH.png">
</div>
<a href="#" class="add-to-cart">
Get 4 Nights
</a>
<p class="price">
$9.99 <s>$12.00</s>
</p>
</div>
</div>
<div class="col som-12-pack">
<div class="inner">
<div class="image">
<img src="https://i.imgur.com/iIhjPiH.png">
</div>
<em class="best-seller">#1 Best Seller</em>
<a href="#" class="add-to-cart">
Get 12 Nights
</a>
<p class="price">
$29.99 <s>$36.00</s>
</p>
</div>
</div>
<div class="col som-24-pack">
<div class="inner">
<div...
SCSS
html {
font-size: 10px;
}
body {
font-size: 1.6rem;
}
.container {
max-width: 1002px;
padding-top: 3em;
}
// Custom CSS
.product-type {
margin: 0 0 4em 0;
padding: 0;
list-style: none;
text-align: center;
li {
display: inline-block;
&:first-child {
margin-right: 7em;
}
}
label {
text-transform: uppercase;
font-weight: 500;
font-size: 2.4rem;
position: relative;
cursor: pointer;
padding: 0 0 0 2.25em;
}
label::before {
content: '';
border: 3px solid #cdcdcd;
position: absolute;
left: 0;
top: 0.3em;
width: 1em;
height: 1em;
border-radius: 50%;
transition: border-width 0.1s ease-in-out;
}
input[type="radio"]:checked + label {
color: #69cd3c;
}
input[type="radio"]:checked + label::before {
border: 8px solid #69cd3c;
}
}
.products {
text-align: center;
.inner {
max-width: 270px;
margin: 0 auto;
}
}
.image {
background-color: #ddeef7;
margin-bottom: 1.2em;
position: relative;
padding-top: 100%;
img {
position: absolute;
max-width: 80%;
height: auto;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
}
.price {
font-size: 2.4rem;
margin: 0;
padding: 0;
font-weight: 500;
s {
margin-left: 0.25em;
}
}
.add-to-cart {
background-color: #69cd3c;
color: #fff;
display: block;
font-size: 2.4rem;
text-transform: uppercase;
font-weight: 500;
margin: 0 0 1em 0;
padding: 0.5em 0.25em;
letter-spacing: 0.05em;
&:hover {
color: #fff;
text-decoration: none;
}
}
.best-seller {
background-color: #01c4fe;
color: #fff;
font-size: 2.4rem;
font-style: normal;
position: absolute;
...