+ 4

How to align a button to center?

please give codes

16th Sep 2017, 5:22 PM
Jitesh Gupta
7 Answers
+ 10
Something like this could work: <!DOCTYPE html> <html> <head> <title>Page Title</title> <style> body { text-align: center; } </style> </head> <body> <button> This is a button </button> </body> </html> Edit: No Problem :)
16th Sep 2017, 5:36 PM
LynTon
LynTon - avatar
+ 6
you can use into a p or div tag and use align property
16th Sep 2017, 5:31 PM
Daniel
Daniel - avatar
16th Sep 2017, 11:55 PM
CalviŐ˛
CalviŐ˛ - avatar
+ 2
ty Daniel
16th Sep 2017, 5:33 PM
Jitesh Gupta
+ 2
So this is not my work and I honestly cannot remember who I copied it from. If this is your work please let me know and I'll credit you. This code aligns your button in the center of the page both horizontally and vertically. Basically, place your button into a div with centred text: <div class="wrapper"> <button class="button">Button</button> </div> With the following styles: .wrapper { text-align: center; } .button { position: absolute; top: 50%; }
16th Sep 2017, 5:45 PM
Baltaza 410
Baltaza 410 - avatar
+ 1
ty LP4
16th Sep 2017, 5:37 PM
Jitesh Gupta
0
ty Baltaza, but this is not my work
16th Sep 2017, 5:48 PM
Jitesh Gupta