+ 13

How to keep a Button exactly at the center horizontaly inside a div?

13th Dec 2018, 2:21 PM
DIPTIRANI SAHU
12 Answers
+ 10
div { display: flex; } button { margin: auto; } https://code.sololearn.com/WOeM1xJ20vD2/?ref=app
13th Dec 2018, 2:48 PM
Calviղ
Calviղ - avatar
+ 7
Calviղ Thanks 😊
13th Dec 2018, 3:21 PM
DIPTIRANI SAHU
+ 6
I use button{ margin:auto; display:block; }
13th Dec 2018, 5:44 PM
Sudarshan Rai
Sudarshan Rai - avatar
14th Dec 2018, 11:41 AM
DIPTIRANI SAHU
+ 3
I use button{ margin:auto; display:block; }
15th Dec 2018, 6:49 PM
‎Emad Esmail ‎
‎Emad Esmail ‎ - avatar
+ 2
v align and h align tutorial by Domino https://www.sololearn.com/post/37760/?ref=app About two months later, Domino herself recommended to use old ways because flexbox has compatibility issue.
15th Dec 2018, 2:06 AM
Gordon
Gordon - avatar
+ 2
div{ display:flex; justify-content:center; align-items: center; }
15th Dec 2018, 2:56 PM
Gildo Vargas H.
Gildo Vargas H. - avatar
+ 1
calvin... why is the display flex pls?
14th Dec 2018, 12:27 AM
Enoch
Enoch - avatar
+ 1
button{ margin:0 auto; } first value for vertical and next value for horizontal u can use % or px or auto (this method your browser set it up)
15th Dec 2018, 9:02 AM
sajjad.zamani
sajjad.zamani - avatar
0
Gordon Why @domino profile is an empty page? 😱
15th Dec 2018, 2:35 AM
Calviղ
Calviղ - avatar
0
Calviղ 😭
15th Dec 2018, 2:44 AM
Gordon
Gordon - avatar