How to center text inside the add to cart button

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

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;
}

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

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!

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

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

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;
}

Hi @INKLY ,

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

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

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

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 !

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