t4t5 / sweetalert

A beautiful replacement for JavaScript's "alert"
https://sweetalert.js.org
MIT License
22.4k stars 2.84k forks source link

button center #834

Closed rapeflower closed 5 years ago

rapeflower commented 6 years ago

How do I make the button centered

davemuir commented 6 years ago

you can ctrl+f for .swal-footer in the dist/sweetalert.min.js and update the style it's dumping for text-align:right to center. I think this should be committed to the project as the buttons look pretty off to the right.

rexx-org commented 5 years ago

Thanks for the tip. Works well! I agree that multiple buttons look better when centered. Hopefully someone could add "align" property for button object?

t4t5 commented 5 years ago

No need to change the repo's source code. You can simply add the following CSS to your page:

swal-footer {
  text-align: center;
}

You can find more styling options here.

rexx-org commented 5 years ago

Thanks for the link to the themes; should have looked there first! Just to clarify, the change should be: .swal-footer { text-align: center; } Works perfectly.