- 1
How to align centre a div.
thanks
3 ответов
+ 8
A <div> default takes all width available in its parent, so it's default centered.
If you want to center its content, you need to apply to it 'center' value to 'text-align' css property...
If you want to change its width and align itself to center, you can change its 'display' css property to 'inline-block', and set 'text-align:center;' to its parent element...
+ 3
margin: 0 auto;
or use flexbox
+ 3
assign a width and then make margin:auto;