Home › CSS Tutorial › Live project: Pricing cards
Live project: Pricing cards
Style three pricing cards with flexbox and hover effects.
Use selectors, the box model, flexbox and transitions to design a pricing section.
What you will build
- Three cards laid out in a row that wraps on small screens
- A highlighted best-value card
- A hover lift animation and styled buttons
Steps
- Read the CSS:
.plansuses flexbox,.cardsets the look. - Change the colors and sizes.
- Press Run and move the mouse over a card.
- Add a fourth card in the HTML.
Run it
Press Run to see the project work. Then change the data in the editor and run it again.
Challenge
- Make the highlighted card slightly larger.
- Add a dark theme with a media query.
Example code
<style>
body { font-family: sans-serif; background: #f2f5f9; padding: 20px; }
.plans { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.card { background: #fff; border-radius: 12px; padding: 20px; width: 160px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.1); transition: transform .2s; }
.card:hover { transform: translateY(-6px); }
.card h2 { margin: 0 0 8px; }
.price { font-size: 28px; font-weight: bold; color: #1b6ca8; }
.card.best { border: 2px solid #87ceeb; }
.card a { display: inline-block; margin-top: 12px; padding: 8px 14px; background: #14213d; color: #fff; border-radius: 6px; text-decoration: none; }
</style>
<div class="plans">
<div class="card"><h2>Free</h2><div class="price">$0</div><p>1 project</p><a href="#">Start</a></div>
<div class="card best"><h2>Pro</h2><div class="price">$9</div><p>10 projects</p><a href="#">Choose</a></div>
<div class="card"><h2>Team</h2><div class="price">$29</div><p>Unlimited</p><a href="#">Contact</a></div>
</div>