chewyoda Posted July 21, 2023 Posted July 21, 2023 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}
CassAggett Posted July 21, 2023 Posted July 21, 2023 Hey Chewy, can you share your website address? You'll probably need to target the img element directly but can check on your site 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. WEBSITE • INSTAGRAM
chewyoda Posted July 21, 2023 Author Posted July 21, 2023 (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 July 21, 2023 by chewyoda
Solution CassAggett Posted July 21, 2023 Solution Posted July 21, 2023 (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! Edited July 21, 2023 by CassAggett added screenshot tuanphan 1 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. WEBSITE • INSTAGRAM
chewyoda Posted July 21, 2023 Author Posted July 21, 2023 That was it Cass, works perfectly! Thank you! CassAggett 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment