How do I align a button to the center of the page | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 5

How do I align a button to the center of the page

I’m trying to work on a project and I can’t figure out how to align the button to the center of the page.

19th Nov 2018, 10:39 PM
FlamingSquid
FlamingSquid - avatar
10 Réponses
+ 7
Add to the container this css style: .container { text-align: center; }
19th Nov 2018, 10:54 PM
InvBoy [ :: FEDE :: ]
InvBoy [ :: FEDE :: ] - avatar
+ 5
If you want to be anything in the center exist <center> tag
20th Nov 2018, 8:03 AM
Basel.Al_hajeri?.MBH()
Basel.Al_hajeri?.MBH() - avatar
+ 3
Alex, <center> does not have closure.
21st Nov 2018, 1:52 PM
InvBoy [ :: FEDE :: ]
InvBoy [ :: FEDE :: ] - avatar
19th Nov 2018, 10:55 PM
InvBoy [ :: FEDE :: ]
InvBoy [ :: FEDE :: ] - avatar
+ 1
https://code.sololearn.com/W51CLpHyrWy0/?ref=app
20th Nov 2018, 2:45 PM
Gordon
Gordon - avatar
+ 1
button{ display: block; margin: 0 auto;}
20th Nov 2018, 3:24 PM
Heros
Heros - avatar
+ 1
.selector{ text-align: center; }
21st Nov 2018, 2:53 PM
Mazhar Khan
Mazhar Khan - avatar
0
You can go into the html tab and write with in the button element. Example: <button align = "center"></button>. You can go into the css tab and do the following: button { position:fixed; top:40%; right:30%; } depending on the size of the button you may need to re position the top and right numbers,
20th Nov 2018, 6:46 PM
Brett
Brett - avatar
0
to align a button simply in html you can put <center><button></button></center>
21st Nov 2018, 8:44 AM
Alex
Alex - avatar
0
button { text-align: center; }
21st Nov 2018, 7:08 PM
Alex
Alex - avatar