body {
margin: 0;
min-height: 100vh;
display: grid;
place-items: center;
background: #f5f4f0;
color: #16171b;
font: 15px/1.45 system-ui, sans-serif;
}
.pricing {
width: min(820px, 100% - 32px);
padding: 24px 0;
}
.billing {
display: flex;
width: fit-content;
margin: 0 auto 22px;
padding: 4px;
border: 0;
border-radius: 999px;
background: #e7e5df;
}
.billing input {
position: absolute;
opacity: 0;
}
.billing label {
padding: 0.45em 1em;
border-radius: 999px;
color: #5f626b;
font-size: 0.9rem;
font-weight: 500;
cursor: pointer;
}
.billing input:checked + label {
background: #fff;
color: #16171b;
box-shadow: 0 1px 2px rgb(0 0 0 / 0.08);
}
.billing input:focus-visible + label {
outline: 2px solid #16171b;
}
.billing__save {
margin-left: 4px;
color: #2f7d4f;
font-size: 0.78rem;
}
.plans {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
gap: 12px;
}
.plan {
position: relative;
display: flex;
flex-direction: column;
padding: 22px;
border: 1px solid #e2dfd8;
border-radius: 16px;
background: #fff;
}
.plan--featured {
border-color: #16171b;
box-shadow: 0 18px 40px -22px rgb(0 0 0 / 0.4);
}
.plan__badge {
position: absolute;
top: -11px;
left: 22px;
margin: 0;
padding: 2px 10px;
border-radius: 999px;
background: #16171b;
color: #fff;
font-size: 0.72rem;
font-weight: 600;
}
.plan__name {
margin: 0;
font-size: 1rem;
}
.price {
display: flex;
align-items: baseline;
gap: 4px;
margin: 10px 0 4px;
}
.price__amount::before {
content: "$" attr(data-monthly);
font-size: 2.2rem;
font-weight: 700;
letter-spacing: -0.03em;
}
.pricing:has(#yearly:checked) .price__amount::before {
content: "$" attr(data-yearly);
}
.price__period {
color: #73767f;
font-size: 0.85rem;
}
.plan__text {
margin: 0 0 14px;
color: #5f626b;
font-size: 0.88rem;
}
.plan__list {
display: grid;
gap: 8px;
margin: 0 0 20px;
padding: 0;
list-style: none;
font-size: 0.88rem;
}
.plan__list li {
display: flex;
align-items: center;
gap: 8px;
}
.plan__list svg {
flex: none;
color: #2f7d4f;
}
.plan__cta {
margin-top: auto;
padding: 0.65em;
border: 1px solid #d6d3cb;
border-radius: 10px;
color: inherit;
font-weight: 600;
text-align: center;
text-decoration: none;
}
.plan--featured .plan__cta {
border-color: #16171b;
background: #16171b;
color: #fff;
}
.visually-hidden {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
}How to use it
Each price is a
<span class="price__amount"> with data-monthly and data-yearly. The CSS shows one or the other depending on which radio is checked. Mark the plan you want to highlight with .plan--featured.