How do I center button both vertically and horizontally? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do I center button both vertically and horizontally?

I tried several ways, including: - display: inline-block; + margin: auto; - put it into separate "div" and set it's margin to "auto"; - in some other forum, I've found that button should be aligned as text. I tried "vertical-align" - it didn't work also. Best I could achive is only horizontal center align. p.s.: I work in Mozilla. Maybe there is some special selector for it?

3rd Oct 2017, 3:38 PM
Mikhail Sladkomedov
Mikhail Sladkomedov - avatar
3 Answers
+ 2
*{ margin: 0px; padding: 0px; }; #button { margin: 10px; padding: 10px; text-align: center; };
3rd Oct 2017, 3:43 PM
onekpsc
+ 1
thank you friends!;)
3rd Oct 2017, 3:46 PM
Mikhail Sladkomedov
Mikhail Sladkomedov - avatar