Question:How can I horizontally center a
Best Answer:You can apply this CSS to the inner
50%. Any width less than the containing
<div>will work. The
margin: 0 autois what does the actual centering.
If you are targeting Internet Explorer 8 (and later), it might be better to have this instead:
Working example here:
flexboxit is very easy to style the div horizontally and vertically centered.
To align the div vertically centered, use the property
If you have better answer, please add a comment about this, thank you!