<main class="shop-container">
  <div class="shop-header">
    <h1>Leafy Haven: Indoor Plants</h1>
    <p>Transform your space into a green sanctuary with our carefully curated selection of indoor plants. Each plant is chosen for its unique characteristics and air-purifying qualities.</p>
  </div>

  <div class="categories">
    <button class="category-button active" data-category="all">All Plants</button>
    <button class="category-button" data-category="low-light">Low Light</button>
    <button class="category-button" data-category="air-purifying">Air Purifying</button>
    <button class="category-button" data-category="pet-friendly">Pet Friendly</button>
    <button class="category-button" data-category="succulents">Succulents</button>
  </div>

  <div class="products-grid">
    <div class="product-card" data-categories="low-light,air-purifying">
      <div class="product-image">
        <img src="https://assets.codepen.io/406785/peace-lily_1.jpg" alt="" />
      </div>
      <div class="product-details">
        <h2 class="product-name">Peace Lily</h2>
        <p class="product-description">An elegant air-purifying plant that produces beautiful white flowers. Thrives in low to moderate light conditions.</p>
        <div class="product-footer">
          <span class="product-price">$45</span>
          <button class="add-to-cart">Add to Cart</button>
        </div>
      </div>
    </div>

    <div class="product-card" data-categories="air-purifying">
      <div class="product-image">
        <img src="https://assets.codepen.io/406785/mostera.jpg" alt="" />
      </div>
      <div class="product-details">
        <h2 class="product-name">Monstera Deliciosa</h2>
        <p class="product-description">The Swiss Cheese Plant, known for its distinctive leaves and easy care requirements. Perfect for adding a tropical touch.</p>
        <div class="product-footer">
          <span class="product-price">$65</span>
          <button class="add-to-cart">Add to Cart</button>
        </div>
      </div>
    </div>

    <div class="product-card" data-categories="low-light,air-purifying,succulents">
      <div class="product-image">
        <img src="https://assets.codepen.io/406785/snake.webp" alt="" />
      </div>
      <div class="product-details">
        <h2 class="product-name">Snake Plant</h2>
        <p class="product-description">A hardy succulent that's perfect for beginners. Known for its air-purifying abilities and striking vertical leaves.</p>
        <div class="product-footer">
          <span class="product-price">$35</span>
          <button class="add-to-cart">Add to Cart</button>
        </div>
      </div>
    </div>

    <div class="product-card" data-categories="pet-friendly,air-purifying">
      <div class="product-image">
        <img src="https://assets.codepen.io/406785/spider.jpg" alt="" />
      </div>
      <div class="product-details">
        <h2 class="product-name">Spider Plant</h2>
        <p class="product-description">Easy to grow and propagate, this plant is perfect for hanging baskets. Safe for pets and great for air purification.</p>
        <div class="product-footer">
          <span class="product-price">$25</span>
          <button class="add-to-cart">Add to Cart</button>
        </div>
      </div>
    </div>

    <div class="product-card" data-categories="succulents">
      <div class="product-image">
        <img src="https://assets.codepen.io/406785/aloe.jpg" alt="" />
      </div>
      <div class="product-details">
        <h2 class="product-name">Aloe Vera</h2>
        <p class="product-description">A versatile succulent with healing properties. Thrives in bright light and requires minimal watering.</p>
        <div class="product-footer">
          <span class="product-price">$30</span>
          <button class="add-to-cart">Add to Cart</button>
        </div>
      </div>
    </div>

    <div class="product-card" data-categories="low-light,pet-friendly">
      <div class="product-image">
        <img src="https://assets.codepen.io/406785/fern.webp" alt="" />
      </div>
      <div class="product-details">
        <h2 class="product-name">Boston Fern</h2>
        <p class="product-description">A classic houseplant with delicate, arching fronds. Perfect for hanging baskets and safe for pets.</p>
        <div class="product-footer">
          <span class="product-price">$40</span>
          <button class="add-to-cart">Add to Cart</button>
        </div>
      </div>
    </div>

    <div class="product-card" data-categories="succulents,pet-friendly">
      <div class="product-image">
        <img src="https://assets.codepen.io/406785/echiveria.jpg" alt="" />
      </div>
      <div class="product-details">
        <h2 class="product-name">Echeveria</h2>
        <p class="product-description">A beautiful rosette-forming succulent that comes in various colours. Pet-safe and perfect for bright windowsills.</p>
        <div class="product-footer">
          <span class="product-price">$20</span>
          <button class="add-to-cart">Add to Cart</button>
        </div>
      </div>
    </div>

    <div class="product-card" data-categories="low-light,air-purifying">
      <div class="product-image">
        <img src="https://assets.codepen.io/406785/zz.webp" alt="" />
      </div>
      <div class="product-details">
        <h2 class="product-name">ZZ Plant</h2>
        <p class="product-description">An almost indestructible plant with glossy leaves. Tolerates low light and irregular watering perfectly.</p>
        <div class="product-footer">
          <span class="product-price">$55</span>
          <button class="add-to-cart">Add to Cart</button>
        </div>
      </div>
    </div>
  </div>
</main>
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Arial";
  background-image: linear-gradient(
    45deg,
    hsl(96deg 48% 8%) 0%,
    hsl(103deg 40% 12%) 8%,
    hsl(103deg 40% 16%) 17%,
    hsl(102deg 40% 20%) 25%,
    hsl(102deg 41% 24%) 33%
  );
  background-attachment: fixed;
  min-height: 100vh;
  color: #333;
}

.shop-container {
  max-width: 1400px;
  margin: 40px auto;
  padding: 0 20px;
}

.shop-header {
  color: #fff;
  margin-bottom: 40px;
}

.shop-header h1 {
  font-size: calc(3rem + 0.5vw);
  margin-bottom: 20px;
}

.shop-header p {
  font-size: 1.2rem;
  opacity: 0.9;
  max-width: 600px;
}

.categories {
  display: flex;
  gap: 15px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.category-button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 10px 20px;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.category-button:hover,
.category-button.active {
  background: #8dc26f;
  border-color: #8dc26f;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 30px;
  margin-bottom: 50px;
}

.product-card {
  background: #fff;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.product-card[data-hidden="true"] {
  display: none;
}

.product-image {
  height: 300px;
  background: linear-gradient(to bottom, #9fd483, #8dc26f);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.product-details {
  padding: 25px;
  display: flex;
  flex-direction: column;
  height: 250px;
}

.product-name {
  font-family: 'PT Serif', serif;
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.product-description {
  color: #666;
  line-height: 1.4;
  margin-bottom: 20px;
  flex-grow: 1;
}

.product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.product-price {
  font-size: 1.5rem;
  font-weight: bold;
  color: #58873d;
}

.add-to-cart {
  background: #58873d;
  color: #fff;
  border: none;
  padding: 12px 25px;
  border-radius: 25px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.add-to-cart:hover {
  background: #70a751;
}

@media (max-width: 768px) {
  .shop-header h1 {
    font-size: 2.5rem;
  }

  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
  }

  .product-image {
    height: 250px;
  }
}
document.addEventListener('DOMContentLoaded', () => {
  const categoryButtons = document.querySelectorAll('.category-button');
  const productCards = document.querySelectorAll('.product-card');

  categoryButtons.forEach(button => {
    button.addEventListener('click', () => {
      categoryButtons.forEach(btn => btn.classList.remove('active'));
      button.classList.add('active');

      const selectedCategory = button.dataset.category;

      productCards.forEach(card => {
        if (selectedCategory === 'all') {
          card.setAttribute('data-hidden', 'false');
        } else {
          const cardCategories = card.dataset.categories.split(',');
          card.setAttribute('data-hidden', !cardCategories.includes(selectedCategory));
        }
      });
    });
  });
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.