SmartCodingTips

Pricing Table in CSS

A pricing table showcases your product plans and features clearly. With CSS, you can create responsive, modern-looking pricing cards that are easy to scan and visually appealing.

1. HTML Structure

Use a simple flex or grid layout for your pricing cards:


Basic

$9/mo

  • 1 Website
  • Email Support
  • 1GB Storage

2. CSS Styling

Here's a basic responsive pricing table style using Flexbox:


.pricing-table {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
}

.pricing-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 2rem;
    width: 300px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s ease;
}

.pricing-card:hover {
    transform: translateY(-5px);
}

.pricing-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.pricing-card .price {
    font-size: 2rem;
    color: #2563eb;
    margin: 1rem 0;
}

.pricing-card ul {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.pricing-card ul li {
    margin: 0.5rem 0;
    color: #4b5563;
}

.pricing-card button {
    background-color: #2563eb;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
}
            

3. Highlight Featured Plan

Use a special class to draw attention to the most popular plan:


.pricing-card.featured {
    border: 2px solid #2563eb;
    background-color: #f0f9ff;
}
            

4. Responsive Design Tips

  • Use flex-wrap to wrap cards on small screens.
  • Use max-width: 100% for mobile friendliness.
  • Reduce padding and font size on smaller devices.
  • Test hover and click interactions on touch devices.

Conclusion

A pricing table communicates your value clearly. With modern CSS, you can build responsive, accessible, and visually compelling plans that work well across all devices.