Jump to content

Center Align Grid Gallery Content | For Logos

Go to solution Solved by tuanphan,

Recommended Posts

  • 2 weeks later...
Posted

Hi,

I supposed you can just manually center them as objects on the fluid grid. If you are doing a simple list item, they will default to left alignment. Some custom code in the page header you can use for centering is as follows: Just replace the section ID with your specific section ID. 

<style>
/*center elements - cane*/
  section[data-section-id="6553fb75f983e40f4b5ed4e2"] .user-items-list-item-container {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: start !important;
    justify-content: center !important;
  }
  section[data-section-id="6553fb75f983e40f4b5ed4e2"] .user-items-list-item-container .list-item {
    width: 25% !important;
    min-width: 260px !important;
  }
  </style>

 

Posted

You can also try this CSS code (Website > Website Tools > Custom CSS)

/* center gallery items */
@media screen and (min-width:768px) {
[data-section-id="64ff143e50c1aa4325121d83"] figure:nth-child(n+1) {
    position: relative;
    left: calc(~"100% + 7.5vw");
}
}

 

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!)

Posted (edited)
On 11/17/2023 at 6:56 PM, elschwartzo said:

Hi,

I supposed you can just manually center them as objects on the fluid grid. If you are doing a simple list item, they will default to left alignment. Some custom code in the page header you can use for centering is as follows: Just replace the section ID with your specific section ID. 

<style>
/*center elements - cane*/
  section[data-section-id="6553fb75f983e40f4b5ed4e2"] .user-items-list-item-container {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: start !important;
    justify-content: center !important;
  }
  section[data-section-id="6553fb75f983e40f4b5ed4e2"] .user-items-list-item-container .list-item {
    width: 25% !important;
    min-width: 260px !important;
  }
  </style>

 

Unfortunately I own only the base subscription of Squarespace so I can't place the code in my header, but thank you anyways.

Edited by Maxter
Posted
8 hours ago, tuanphan said:

You can also try this CSS code (Website > Website Tools > Custom CSS)

/* center gallery items */
@media screen and (min-width:768px) {
[data-section-id="64ff143e50c1aa4325121d83"] figure:nth-child(n+1) {
    position: relative;
    left: calc(~"100% + 7.5vw");
}
}

 

Thank you,

this CSS code worked for me.

Is there a way to downsize images for the mobile version? Right know each image uses 50% of the screen space.

mobile_logos.PNG

Posted
On 11/19/2023 at 6:57 PM, Maxter said:

Thank you,

this CSS code worked for me.

Is there a way to downsize images for the mobile version? Right know each image uses 50% of the screen space.

mobile_logos.PNG

Use this CSS code

/* 4 images at bottom of page */
@media screen and (max-width:767px) {
[data-section-id="64ff143e50c1aa4325121d83"] .gallery-grid-wrapper {
    grid-template-columns: repeat(4,1fr) !important;
    display: grid !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!)

Posted
On 11/19/2023 at 4:27 AM, tuanphan said:

You can also try this CSS code (Website > Website Tools > Custom CSS)

/* center gallery items */
@media screen and (min-width:768px) {
[data-section-id="64ff143e50c1aa4325121d83"] figure:nth-child(n+1) {
    position: relative;
    left: calc(~"100% + 7.5vw");
}
}

 

I just noticed this code works only if there are exactly 4 images in the grid gallery. At the bottom of this page:

https://www.maximfischer.de/work/the-artist-bachelor-project-3d-animation
image.thumb.png.d653263ded20f79fd588c2d1e3c0a53e.png

I have 8 images in a row of 6. The last two images in the second row should be then centered. And it would be perfect if for example there are only 3 images that get automaticly centered without calculating the viewport width.

I think this css code should solve this but I couldnt get it to work with my sites:

// Center Last Images - Grid Gallery Block //

.sqs-gallery-block-grid .sqs-gallery-design-grid {
  flex-wrap: wrap !important;
  display: flex !important;
  justify-content: center !important;
}

Posted
3 hours ago, tuanphan said:

Use flex or the code I sent, you will also need a different code for each page, there is no universal code for all

Use flex, you will need to set width of 8 items

image.png.9cc55681d7e44731346f1f858634661d.png

image.thumb.png.b2cae18597cd0fa8acf56baece842edb.png

I tried to integrate the code as followed:


@media screen and (min-width:768px) {
[data-section-id="655df279319bf92e4ef467d2"] .gallery-grid--layout-grid .gallery-grid-wrapper {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}
}

but then all the images disappear. I'm sorry if I ask too much. 

Posted

Ops. I saw that piece of code but when I tried to implement it, nothing changed. I did it wrong.
Now I corrected it and it works:


@media screen and (min-width:768px) {
[data-section-id="655df279319bf92e4ef467d2"] .gallery-grid--layout-grid .gallery-grid-wrapper {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
figure.gallery-grid-item {
    width: 8%;
  }
}
}

Thank you so much! You made my day

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.