Jump to content

Gallery pages - Always 4 or 2 across dependant on device

Go to solution Solved by Lesum,

Recommended Posts

Posted

Hello, could someone clever help me with a change to my site's gallerys?

They have always worked with the below code to force either gallery as 2 mobile/4 desktop items.

Now I'm finding they can trip to 3 dependant on window size.

Has something changed?

Thanks for any help in advance.

Karen

 

/*Grid Galleries*/
/*Set galleries 2 columns on small tablets & mobile*/
@media screen and (max-width:767px) {
  /*Home page*/ #collection-5f0838d6114117107d0633a7,
  /*Portfolio page*/ #collection-5f0dc75be4b78a3c97a770d6,
  /*Commissions page*/ #collection-5f084534dd6f773fb0a43fb9

  {
    .gallery-grid--layout-grid .gallery-grid-wrapper {
      grid-template-columns: repeat(2,auto) !important;
    }
  }
}
@media screen and (min-width:768px) {
  /*Home page*/ #collection-5f0838d6114117107d0633a7,
  /*Portfolio page*/ #collection-5f0dc75be4b78a3c97a770d6,
  /*Comissions page*/ #collection-5f084534dd6f773fb0a43fb9

  {
    .gallery-grid--layout-grid .gallery-grid-wrapper {
      grid-template-columns: repeat(4,auto) !important;
    }
  }
}

  • Solution
Posted

@Karen_Ruby Hi! You can update your existing code to the following and add the code in Website > Pages > Website Tools > Custom CSS

/* Homepage -> Portfolio page -> Commissions page */

#collection-652e9b358e9ce27847c2f9cd .gallery-grid-wrapper, #collection-65361f360f0e9c0655e62712 .gallery-grid-wrapper, #collection-653828f9dedc8d69cd9dec62 .gallery-grid-wrapper {
  display: grid;
  grid-template-columns: repeat(4, 1fr) !important;
}

@media screen and (max-width: 767px) {
  #collection-652e9b358e9ce27847c2f9cd .gallery-grid-wrapper, #collection-65361f360f0e9c0655e62712 .gallery-grid-wrapper, #collection-653828f9dedc8d69cd9dec62 .gallery-grid-wrapper {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

If my comments were useful, please like or mark my solution as answer so others can scroll to it quickly. 

Sam
Web Developer & Digital Designer

 Did you find my contribution helpful? Buy me a coffee?

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.