Custom CSS for centering a custom Sale Badge

Custom CSS for centering a custom Sale Badge

lucyh
Shopify Partner
25 0 6

Hey friends! 

I need a little of help to finish customizing a sale badge! How the heck do I get these to line up centered? 

(as a side note, I would also love a way to have it above the price, centered) 

APPRECIATE IT! 

lucyh_0-1749334940155.png

 

Replies 6 (6)

Betterave-Nina
Tourist
61 7 8

Hi @lucyh. May I see the page URL with the sale badge? Thanks!

➡➡   Easy Embed Code   ⬅⬅ insert CSS/JS/HTML/Liquid code into any store page



Speed Booster App - Improve your store speed in 3 clicks
Need professional help with your Shopify store? DM me, let's talk!
Geeky notes
Betterave-Nina
Tourist
61 7 8

It looks like you've already changed the badge and this one doesn't need centering.

 

If you still want to display the badge above the price, you can do the following:

 

1: Go to Online Store -> Theme -> Edit code
2: Search file base.css
3: Add the following code to the bottom of the file -> Save

 

.price.price--large.price--on-sale.price--show-badge {
    display: flex;
    flex-flow: column-reverse;
}

.price.price--large.price--on-sale.price--show-badge > * {
  align-self: flex-start;
  width: auto;
}

 

If done correctly, the result should be like this:

Screenshot_3.png

 

I hope this helps!

➡➡   Easy Embed Code   ⬅⬅ insert CSS/JS/HTML/Liquid code into any store page



Speed Booster App - Improve your store speed in 3 clicks
Need professional help with your Shopify store? DM me, let's talk!
Geeky notes
lucyh
Shopify Partner
25 0 6

I figured it out, thank you! 

BiDeal-Discount
Shopify Partner
789 103 176

Hi @lucyh 

let try to add this Custom CSS to the bottom of your file base.css:

.product__info-container .price--large {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
}
.product__info-container .product__text,
.product__info-container .product__title,
.product__info-container .product__tax,
.product__info-container .product-form__quantity {
  text-align: center;
}
.product__info-container .product-form__quantity {
  max-width: unset;
}
.product__info-container .product-form__input price-per-item,
.product__info-container  .price-per-item__container {
  justify-content: center;
}
.product__info-container .product-form__buttons {
  margin-inline: auto;
}

The result:

BiDealDiscount_0-1749345899617.png

 

- Helpful? Like & Accept solution! Coffee tips fuel my dedication.
- BiDeal Bundle Volume Discounts: Upsell with discount bundles, quantity breaks, volume discounts & mix-and-match bundles. AOV+ with free gifts, free shipping & progressive cart
- Contact me via WhatsApp

Bundler-Manuel
Astronaut
1115 51 131

Hey there! @lucyh  If you are looking for something short and pretty straightforward to have a look at, I highly recommend this video https://m.youtube.com/watch?v=BhcgyTMe6iU 

Emmanuel
Please let me know if it works by marking it as a solution!
Bundler - Product Bundles app, a great bundle app for Shopify, with glowing user testimonials and a free plan.