Search code examples
javascripthtmlcssshopifyshopify-template

Adding a Product List on Image


I am using the minimal template in Shopify and would like to recreate this image attached. I have tried researching for similar examples but can't seem to find anything. How do I go about creating this image? How do I get an image behind a menu?

Trying to Create

Any links or documents to achieving image would really help.


Solution

  • Try to break down the design to work out it's constituent parts. You want a background image and an overlay with product cards. You want to position the overlay on top of the picture you do this by applying position:relative to the parent and position:absolute to the child so it will be positioned within it's parent. Then apply transform: translate() to translate the overlay dependant on it's size to achieve the offset on the right hand side.

    Here's a pen : https://codepen.io/NeilWkz/pen/qgRMyW

    <div class="img-hero-with-menu-overlay">
     <div class="left-img">
      </div>
      <div class="overlay">
        <div class="product-card">
          <img src="https://lorempixel.com/300/150/" alt="">
          <div class="info">
            <h3>Product 1</h3>
            <p>lorem</p>
          </div>
        </div>
        <div class="product-card">
          <img src="https://lorempixel.com/300/150/" alt="">
          <div class="info">
            <h3>Product 2</h3>
            <p>lorem</p>
          </div>
        </div>
        <div class="product-card">
          <img src="https://lorempixel.com/300/150/" alt="">
          <div class="info">
            <h3>Product 3</h3>
            <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. </p>
          </div>
        </div>
      </div>
    </div>
    

    The CSS

    img-hero-with-menu-overlay {
      position: relative;
      background-color: #bcbdc0;
      width: 100%;
      display: block;
    }
    .left-img {
      height: 100vh;
      display: block;
      width: 75%;
      background: url("https://www.llialighting.com/Content/files/ProductImages/v_06f3_angled448253599.png")
        no-repeat center center;
      background-size: cover;
    }
    .overlay {
      position: absolute;
      right: 0;
      top: 50%;
      transform: translate(-12.5%, -50%);
      width: 40%;
    }
    
    .product-card {
      display: flex;
      margin-bottom: 1.5rem;
    }
    
    .info {
      padding: 1.5rem;
    }