Issue: User seeks to center text within an add-to-cart button using CSS.
Solutions Provided:
Multiple contributors offered CSS code targeting .product-form__submit span with properties:
display: flex
align-items: center
justify-content: center
gap: 5-10px
Code should be added to base.css, theme.css, or custom CSS section.
Complications:
Initial solutions didn’t work for the user. Investigation revealed:
Missing closing bracket in the CSS file
The base.css file appears corrupted, preventing code additions at the end
Resolution:
One solution successfully centered the button text. A contributor offered to send a collaborator invite to examine and fix the corrupted base.css file directly.
Alternative Approach:
Another suggestion involved adding CSS through the product page’s custom CSS section and removing the button--full-width class for additional styling control.
Summarized with AI on November 7.
AI used: claude-sonnet-4-5-20250929.
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.
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.