e1commerce.com
Ask a question
  • New questions
  • With the answers
  • Unanswered
  1. Home
  2. html - Images appear next to each other rather than under

223 votes
1 answers

html - Images appear next to each other rather than under

So to explain my situation: I am trying to build a page on shopify wherein images will appear like so: enter image description here

Right. So I have tried to build a shopify section where trough the shopify website customizer you are supposed to be able to put in images and it should appear like the image.

The issue is: With the current code that I have, the first 3 images work really nicely and appear next to eachother, but when I go to make another block and add 3 new pictures, they appear like so: enter image description here

I only want 3 images on the page, not more. I want it to appear under the first 3, and then the next 3 to also appear under the last 3 etc etc etc.

Here is my code:

<div class="gallery">
  <div class="col">
        {% for block in section.blocks %}
        <div class="image">
          <img src="{{ block.settings.editorial_image | img_url: 'master' }}">
        </div>
  </div>
  <div class="col">
        <div class="image">
          <img src="{{ block.settings.editorial_image2 | img_url: 'master' }}">
        </div>
  </div>
  <div class="col">
      <div class="image">
            <img src="{{ block.settings.editorial_image3 | img_url: 'master' }}">
      </div>
  </div>
  {% endfor %}
</div>

{% schema %}
{
  "name": "EditorialTest2",
  "tag": "section",
  "class": "gallery",
  "max_blocks": 9,
  "settings": [
    {
      "type": "text",
      "id": "title",
      "label": "Editorial"
    }
  ],
  "blocks": [
     {
       "name": "PictureBlock",
       "type": "slide",
       "settings": [
         {
           "type": "image_picker",
           "id": "editorial_image",
           "label": "Image"
           },
                  {
           "type": "image_picker",
           "id": "editorial_image2",
           "label": "Image"
           },
                  {
           "type": "image_picker",
           "id": "editorial_image3",
           "label": "Image"
           }
       ]
     }
   ],
   "presets": [
    {
      "name": "Editorial Section Test 2"
    }
  ]
  }
{% endschema %}

<style>
  .gallery {
    display: flex;
  }

  @media only screen and (max-width: 560px) {
    .gallery {
      flex-direction: column;
    }
  }
  .image img {
    width: 100%;
  }
</style>

Undefined asked
2022-11-12


733
votes

Answer

Solution:

.row {
  width: 100%;
  display: flex;
  height: 100%;
}

.columns {
  width: 33%;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.red {
  background: red;
}

.blue {
  background: blue;
}
<div class="row">
  <div class="columns red">
    <img src="https://upload.wikimedia.org/wikipedia/commons/b/b6/Image_created_with_a_mobile_phone.png">
    <img src="https://upload.wikimedia.org/wikipedia/commons/b/b6/Image_created_with_a_mobile_phone.png">
    <img src="https://upload.wikimedia.org/wikipedia/commons/b/b6/Image_created_with_a_mobile_phone.png">

  </div>
  <div class="columns blue"> <img src="https://www.seiu1000.org/sites/main/files/main-images/camera_lense_0.jpeg">
    <img src="https://upload.wikimedia.org/wikipedia/commons/b/b6/Image_created_with_a_mobile_phone.png">
    <img src="https://upload.wikimedia.org/wikipedia/commons/b/b6/Image_created_with_a_mobile_phone.png">
  </div>
  <div class="columns red"> <img src="https://upload.wikimedia.org/wikipedia/commons/b/b6/Image_created_with_a_mobile_phone.png">
    <img src="https://www.seiu1000.org/sites/main/files/main-images/camera_lense_0.jpeg">
    <img src="https://www.seiu1000.org/sites/main/files/main-images/camera_lense_0.jpeg">
  </div>
</div>
Undefined answered
2022-11-12
Link to answer


Source

Didn't find the answer?

Our community is visited by hundreds of Shopify development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Similar questions

Find the answer in similar questions on our website.

925 html - Images appear next to each other rather than under
732 html - My Background image is not working/appearing
437 Shopify HTML embedded video will not appear on iphones
379 animation - shopify dawn theme, animate disappearing paw prints to appear in background?
385 html - Click on image div should appear JavaScript
398 Render as HTML the line_item.properties data who has HTML values in it on Shopify Admin Orders
365 html - Shopify - How to call images and tittles from a specific collection into the product recommendation module
835 How can I add an Amazon Site Stripe html image code so that it appears as a product featured image in Shopify
239 html - Click on image div should appear JavaScript
124 javascript - is there any way to dowload more than 50+ images in shopify

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.







Latest questions:

219 Get product description with metafield in shopify

736 html - CSS animation looks wrong/broken in some places on iOS devices only?

296 Shopify refund amount wrong when refund in pending state (Admin REST API)

942 How to Add Fonts to the Shopify Admin

303 css selectors - Custom font for specific language shopify



© 2021-2023

E-mail: infot@e1commerce.com