About this snippet

Compare pricing plans using an advanced feature matrix layout. We utilized CSS Grid and position sticky to create a fully responsive, incredibly clean comparison table that highlights your premium tier perfectly.

Size
4.0 KB
Uses
HTML, CSS
Loads
Nothing external
Views
172
<div class="matrix-wrapper">
  <div class="matrix-grid">
    
    <!-- Sticky Header Row -->
    <div class="matrix-header empty-cell"></div>
    <div class="matrix-header">
      <h3>Basic</h3>
      <p>$9 / month</p>
    </div>
    <div class="matrix-header pro-header">
      <div class="popular-badge">Most Popular</div>
      <h3>Pro</h3>
      <p>$29 / month</p>
    </div>
    <div class="matrix-header">
      <h3>Enterprise</h3>
      <p>$99 / month</p>
    </div>
    
    <!-- Row 1 -->
    <div class="feature-name">Projects</div>
    <div class="feature-value">5</div>
    <div class="feature-value pro-value">Unlimited</div>
    <div class="feature-value">Unlimited</div>
    
    <!-- Row 2 -->
    <div class="feature-name">Cloud Storage</div>
    <div class="feature-value">10 GB</div>
    <div class="feature-value pro-value">100 GB</div>
    <div class="feature-value">1 TB</div>
    
    <!-- Row 3 -->
    <div class="feature-name">API Access</div>
    <div class="feature-value text-muted">-</div>
    <div class="feature-value pro-value check-mark">✓</div>
    <div class="feature-value check-mark">✓</div>
    
    <!-- Row 4 -->
    <div class="feature-name">24/7 Support</div>
    <div class="feature-value text-muted">-</div>
    <div class="feature-value pro-value text-muted">-</div>
    <div class="feature-value check-mark">✓</div>
    
    <!-- CTA Row -->
    <div class="feature-name empty-cell"></div>
    <div class="feature-value"><button class="btn-basic">Start Basic</button></div>
    <div class="feature-value pro-value"><button class="btn-pro">Start Pro</button></div>
    <div class="feature-value"><button class="btn-basic">Contact Sales</button></div>
    
  </div>
</div>
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  margin: 0;
  background: #f8fafc;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 40px 20px;
}

.matrix-wrapper {
  width: 100%;
  max-width: 900px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
  overflow-x: auto; /* Handles mobile scrolling safely */
  border: 1px solid #e2e8f0;
}

.matrix-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1.2fr 1fr;
  min-width: 700px;
}

.matrix-header {
  position: sticky;
  top: 0;
  background: #ffffff;
  padding: 30px 20px;
  text-align: center;
  border-bottom: 2px solid #e2e8f0;
  z-index: 10;
}

.empty-cell {
  background: transparent;
  border-bottom: 2px solid #e2e8f0;
}

.matrix-header h3 {
  margin: 0 0 8px 0;
  font-size: 1.5rem;
  color: #0f172a;
}

.matrix-header p {
  margin: 0;
  color: #64748b;
  font-weight: 500;
}

.pro-header {
  background: #f0fdf4;
  border-top: 4px solid #10b981;
  position: relative;
}

.popular-badge {
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  background: #10b981;
  color: #ffffff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.50rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.feature-name {
  padding: 20px;
  font-weight: 600;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
}

.feature-value {
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid #f1f5f9;
  color: #0f172a;
  font-weight: 500;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pro-value {
  background: #f0fdf4;
}

.check-mark {
  color: #10b981;
  font-weight: 800;
  font-size: 1.25rem;
}

.text-muted {
  color: #cbd5e1;
}

.btn-basic, .btn-pro {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-basic {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.btn-basic:hover { background: #e2e8f0; }

.btn-pro {
  background: #10b981;
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

.btn-pro:hover { background: #059669; }
Esc
↑↓ moveEnter select

Start from a template

Open an .html file, or HTML, CSS, JS, Markdown, Less or TypeScript files. You can also drop them here. Styles and scripts go into their panes.

Share

Source

Keyboard shortcuts

Save