Jump to content

Coding a Product Image SOLD OUT overlay-HELP

Recommended Posts

Site URL: https://theretrocollectiveco.com

So I followed this code (from a fellow forum user-thanks!) to add the darkened overlay to my product image when it is sold out. But if you look closely at my very left image, you can see in the top left corner that it says "Sold out" too, meaning it is written twice on the image. I just want the boldened text in the middle of the image for the customers to see. Do yall know how I'd adjust the code so that I didn't see the text in the upper left corner as well? I tried doing it myself but couldn't figure it out. I know this is really nit-picky, but any and all help is appreciated!! 

 

.post-type-store-item.sold-out .grid-image:before {
  content: 'Sold Out';
  font-weight: bolder;
  color: #fff;
  font-size: 2em;
  width: 100%;
  height: 100%;
  position: absolute;
  z-index: 999;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
    align-content: center;
    justify-content: center;
    align-items: center;
}
.post-type-store-item.sold-out .grid-image:after {
  content: 'Sold Out';
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background: #000;
  opacity: 0.2
}
.post-type-store-item.sold-out .product-mark.sold-out {
  display: none;
}

84DDB031-39E1-4BC1-A5CF-EE6DDD2F23BE.png

Link to comment
  • Replies 2
  • Views 582
  • Created
  • Last Reply

Top Posters In This Topic

9 hours ago, Ekat27 said:

Site URL: https://theretrocollectiveco.com

So I followed this code (from a fellow forum user-thanks!) to add the darkened overlay to my product image when it is sold out. But if you look closely at my very left image, you can see in the top left corner that it says "Sold out" too, meaning it is written twice on the image. I just want the boldened text in the middle of the image for the customers to see. Do yall know how I'd adjust the code so that I didn't see the text in the upper left corner as well? I tried doing it myself but couldn't figure it out. I know this is really nit-picky, but any and all help is appreciated!! 

 

.post-type-store-item.sold-out .grid-image:before {
  content: 'Sold Out';
  font-weight: bolder;
  color: #fff;
  font-size: 2em;
  width: 100%;
  height: 100%;
  position: absolute;
  z-index: 999;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
    align-content: center;
    justify-content: center;
    align-items: center;
}
.post-type-store-item.sold-out .grid-image:after {
  content: 'Sold Out';
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background: #000;
  opacity: 0.2
}
.post-type-store-item.sold-out .product-mark.sold-out {
  display: none;
}

84DDB031-39E1-4BC1-A5CF-EE6DDD2F23BE.png

You can get rid of the sold out text in :after element

image.thumb.png.26edd2cb49d34bd7aa8a499219e4237a.png

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment
On 11/7/2021 at 10:48 PM, bangank36 said:

You can get rid of the sold out text in :after element

image.thumb.png.26edd2cb49d34bd7aa8a499219e4237a.png

So I tried this.. when I deleted the first "Sold out" line it did this (pic below) and deleted all of the SOLD OUT text. 1760705913_ScreenShot2021-11-09at1_24_27PM.thumb.png.7a81ddabe78e31aaa483647bda273b23.png

 

Then I undid that and deleted just the second line of SOLD out, and it looks better, but undid the grey overlay on the image (pic below)..any suggestion on what to do from here?

758941204_ScreenShot2021-11-09at1_25_27PM.thumb.png.e551707dee5312c73218d92ea328d23a.png

Your help is much appreciated!

Link to comment

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.