Re: How to center text inside the add to cart button

Solved

How to center text inside the add to cart button

INKLY
Pathfinder
112 0 12

Hi, I would like to center the text inside the add to cart button. But I'm not sure which css does that. Does anyone know how to achieve this result? Thank you for your help. 

 

Store URL: https://inkly.fr/?_ab=0&_fd=0&_sc=1&preview_theme_id=163175923977

INKLY_0-1721058035493.png

 

Accepted Solutions (2)

namphan
Shopify Partner
1006 125 162

This is an accepted solution.

Hi @INKLY,

Please go to Actions > Edit code > Assets > base.css file and paste this at the bottom of the file:

 

.product-form__submit>span {
    display: flex;
    align-items: center;
    gap: 5px;
}

 

Coffee tips fuels my dedication.
Shopify Development Service
Need help with your store? namphan992@gmail.com

View solution in original post

namphan
Shopify Partner
1006 125 162

This is an accepted solution.

Hi @INKLY,

I checked and it seems your base.css file is corrupted, can you add the code here? it will work fine

Coffee tips fuels my dedication.
Shopify Development Service
Need help with your store? namphan992@gmail.com

View solution in original post

Replies 10 (10)

namphan
Shopify Partner
1006 125 162

This is an accepted solution.

Hi @INKLY,

Please go to Actions > Edit code > Assets > base.css file and paste this at the bottom of the file:

 

.product-form__submit>span {
    display: flex;
    align-items: center;
    gap: 5px;
}

 

Coffee tips fuels my dedication.
Shopify Development Service
Need help with your store? namphan992@gmail.com
INKLY
Pathfinder
112 0 12

Hi @namphan, unfortunately that code is not working for me 

namphan
Shopify Partner
1006 125 162

This is an accepted solution.

Hi @INKLY,

I checked and it seems your base.css file is corrupted, can you add the code here? it will work fine

Coffee tips fuels my dedication.
Shopify Development Service
Need help with your store? namphan992@gmail.com
INKLY
Pathfinder
112 0 12

Thank you, it worked ! However, what do you mean by my base.css file is corrupted and how can I fix that? Thank you for your help !

namphan
Shopify Partner
1006 125 162

Hi @INKLY,

Because when I tested, you can't add code at the end of the file, it won't read the code.

If you want, I'll send you a contributor invite and check it out

Coffee tips fuels my dedication.
Shopify Development Service
Need help with your store? namphan992@gmail.com

BSS-TekLabs
Shopify Partner
1792 510 597

Hi @INKLY,You can follow these steps
1. Open Online Store > Theme > Edit Code

2. Find and open the base.css (or theme.css, custom.css) file

3. Paste the code snippet below at the bottom of the file and hit save

.product-form__submit.button span {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

Here is the result

BSSTekLabs_0-1721058485703.png

Hope this helps you solve the issue.

Please don't forget to Like and Mark it as an Accepted Solution if you find this helpful. Thank you!

If our suggestions are useful, please let us know by giving it a like or marking it as a solution .
Need help from our expert? Kindly share your request with us via community@bsscommerce.com
BSS Commerce - Full-service eCommerce Agency

For give Gift to customers and Upsell in Cart, check out Salepify: Free Gifts with purchase


Post purchase upsell, downsell offers to improve sales and AOV
Salemate Post Purchase Upsell

INKLY
Pathfinder
112 0 12

Hi @BSS-TekLabs, thank you for your response, unfortunately I do not get the same resul with you code: 

INKLY_0-1721058713151.png

INKLY_1-1721058734555.png

 

 

BSS-TekLabs
Shopify Partner
1792 510 597

I've checked your site, it is because you don't have a closing bracket. Just add the code below to the end of the base.css file

}
.product-form__submit.button span {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}
If our suggestions are useful, please let us know by giving it a like or marking it as a solution .
Need help from our expert? Kindly share your request with us via community@bsscommerce.com
BSS Commerce - Full-service eCommerce Agency

For give Gift to customers and Upsell in Cart, check out Salepify: Free Gifts with purchase


Post purchase upsell, downsell offers to improve sales and AOV
Salemate Post Purchase Upsell

INKLY
Pathfinder
112 0 12

I do have a closing bracket, it still doesn't work

INKLY_0-1721060845672.png

 

Gideon11
Shopify Partner
46 5 8

Hi, 

1. On the product page, click product information,

2. Scroll to the bottom, and click custom css,

3. copy and paste the code;

 

.product-form__buttons {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

 

You can remove edit code and remove the class button--full-width class on the add to cart button, the class makes sure the add to cart button spans full width 100%.
The class also gives the button its color.

check out this blog for more info.
How to Center Anything with CSS - Align a Div, Text, and More