Jump to content

Gallery Image Borders Not Flush Due to Captions Setting

Go to solution Solved by CassAggett,

Recommended Posts

Posted

Hello, 

I'm adding CSS to my portfolio gallery images and cannot figure out how to flush the borders at the bottom. I have already used code to make the captions only visible when hovering over the images (code used below). Due to this, the image borders have padding at the bottom, normally where the captions would be. Is there any code that would force the bottom borders flush to the images regardless of the captions setting, that can also change color upon hovering the image? The captions are necessary because it's an artist's portfolio, but the hover effect was cleaner than below them. I attempted using padding set to 0 for the border code, however, I removed it because it wasn't working. Coding and images are attached below.

Thank you!

Code used for captions only on hover:
//GALLERY STRIP HOVER EFFECT//
figure.gallery-strips-item {position:relative;}
.gallery-caption {
    position: static;}
/* title */
.gallery-caption-content {
      color:white;
      font-weight:bold!important;
      position:absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
    padding:20%;
    transition: opacity ease 200ms !important;
    opacity: 0 !important;
pointer-events: none;}
.gallery-strips-item:hover .gallery-caption-content {
    opacity: 1 !important;}

Code attempt for image border:
//Gallery image borders/
.gallery-strips-item {border: solid 2px black;!important}

Screenshot 07-20-2023 17.45.05.png

Screenshot 07-20-2023 17.48.12.png

Posted (edited)

Hi Cass, 

I'm using borders across all portfolio images from the folder dropdown (there are 7 image galleries total). It's not a published site yet, so not sure how the password option works, but set it up as below.

site: chiton-scarlet-xsch.squarespace.com

password: artportfolio1234

Thanks!

Edited by chewyoda
  • Solution
Posted (edited)

Thanks! Try replacing the code that you've got for the borders with this one:

.gallery-strips-item img {
  border: solid 2px black;
  box-sizing: border-box;
}

What this does is drill down a couple of layers into the code to reach the actual image that you want the border on - where the code you're currently using adds the border around the entire item which includes where the caption would normally go.

The addition of the box-sizing property is to ensure the border shows around all sides and isn't cut off, basically telling the site to make sure the border is included in the image size.

Let us know how you go!

image.thumb.png.29332606a8050775cc099e3e76c01e3e.png

Edited by CassAggett
added screenshot

Instruction: How to set a site-wide password

If this helped you, please like or mark my solution as answer so others can scroll to it quickly 👆

Cass Aggett is a Squarespace website designer for go-getting women – no matter what stage of business.

WEBSITEINSTAGRAM

 

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.