Quite a "simple" problem here and not sure why it's being so complicated.
Any ideas? :)
Just add margin: 0 auto; to the inside div.
To move the inner div container to the centre of the parent div we have to use the margin property of style attribute. We can adjust the space around any HTML element by this margin property just by providing desired values to it. Now here comes the role of this property in adjusting the inner div.
Just add margin: auto and a fixed width to the element you want to center, and the margins will force the element to center. There are a number of old methods to center multiple divs, but this is now much easier to do using modern CSS techniques.
Simply add text-align center to parent div and set the child div display to inline-block. This will force our div to behave like inline element and therefore subjected text-align center.
.parent { text-align: center; } .parent > .child { margin: 0 auto; width: 900px; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With