Jump to content

[Share] Gallery – 2 columns for desktop gallery and 1 column for mobile

Recommended Posts

To achieve 2 columns of images Gallery on Desktop and 1 column on Mobile, you can follow these.

If CSS code doesn't work, you can send link to page where you use Gallery, I will check it again.

#1. Gallery Grid

You can hover Gallery Section > Click Edit Section

image.png.3564eee0c11893955138b1a4c3ae393a.png

Change number of column images on Desktop here

image.png.51e94e505e0ab2efba54a342c5b666d5.png

On Mobile, you can use this code to Website Tools > Custom CSS to force it to 1 column.

@media screen and (max-width:767px) {
.gallery-grid-wrapper {
    grid-template-columns: repeat(1,1fr) !important;
}}

image.png.558979fb08499eade61b3418a5a112f2.png

If you want to apply this for specific gallery, you can find Gallery ID

In my example, it is

image.png.70decc64bc48701cdf678716d94c950c.png

Next, use CSS code like this to Custom CSS box.

section[data-section-id="66c2fd5aa1b5905d9100c36c"] {
  @media screen and (max-width:767px) {
    .gallery-grid-wrapper {
        grid-template-columns: repeat(1,1fr) !important;
    }
  }
}

#2. Gallery Strips

With Gallery Strips, you can Edit Section

image.png.3564eee0c11893955138b1a4c3ae393a.png

Then adjust the Row Height. For each Row Height value, the gallery will display a different number of columns of images.

image.png.19697e67f460e9a3f3fa9d22defd6354.png

With this change, Strips is already 1 column on Mobile, if you want to force Strips to 2 columns on Mobile, you can use this CSS code to Website Tools > Custom CSS.

@media (max-width: 767px) {
    .gallery-strips .gallery-strips-wrapper {
        columns: 2;
        column-gap: 0;
        height: auto!important;
        display: block!important;
        padding: 0 5px;
    }
    .gallery-strips-item-wrapper {
        height: auto!important;
    }
    .gallery-strips-item {
        position: relative!important;
        transform: none!important;
        width: 100%!important;
        display: block;
        padding: 5px!important;
        box-sizing: border-box;
    }
    .gallery-strips .gallery-strips-item img {
        height: 100%!important;
          width: 100%!important;
    }
}

image.png.3a4abdf868c4c2aa95dce84253676197.png

To make it affect on specific Strips only, you can find Gallery Strips ID, similar #1, then use CSS code like this.

section[data-section-id="66c2fe1078d02d100042a466"] {
@media (max-width: 767px) {
    .gallery-strips .gallery-strips-wrapper {
        columns: 2;
        column-gap: 0;
        height: auto!important;
        display: block!important;
        padding: 0 5px;
    }
    .gallery-strips-item-wrapper {
        height: auto!important;
    }
    .gallery-strips-item {
        position: relative!important;
        transform: none!important;
        width: 100%!important;
        display: block;
        padding: 5px!important;
        box-sizing: border-box;
    }
    .gallery-strips .gallery-strips-item img {
        height: 100%!important;
          width: 100%!important;
    }
}}

image.png.b57601d370bf2ebb28699c001fc7f468.png

#3. Gallery Masonry

You can edit the Gallery Masonry Section then change this option

image.png.b78d09b3092c9006f1e7530cf6c9b10d.png

To make it to 1 column on mobile, you can use this CSS code

@media screen and (max-width:767px) {
  .gallery-masonry-wrapper.gallery-masonry-list--ready {
      height: auto !important;
      display: grid;
      grid-template-columns: repeat(1,1fr) !important;
      grid-column-gap: 10px;
      grid-row-gap: 10px;
  }
  figure.gallery-masonry-item {
      position: relative !important;
      width: 100% !important;
      transform: unset !important;
  }
  .gallery-masonry-item-wrapper {
      height: 100% !important;
  }
  .gallery-masonry-item-wrapper  img {
      width: 100% !important;
  }
}

to make it run on specific Masonry, you can find Masonry Section ID, use #1 tool. Then use CSS code like this.

section[data-section-id="66c2fedf4f347e205755537a"] {
  @media screen and (max-width:767px) {
    .gallery-masonry-wrapper.gallery-masonry-list--ready {
        height: auto !important;
        display: grid;
        grid-template-columns: repeat(1,1fr) !important;
        grid-column-gap: 10px;
        grid-row-gap: 10px;
    }
    figure.gallery-masonry-item {
        position: relative !important;
        width: 100% !important;
        transform: unset !important;
    }
    .gallery-masonry-item-wrapper {
        height: 100% !important;
    }
    .gallery-masonry-item-wrapper  img {
        width: 100% !important;
    }
  }
}

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • Replies 0
  • Views 154
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.