Centering a div tag of unknown width

Centering a div tag of unknown width

You can easily center a div by using margin: 0 auto; CSS property when you have its width in your CSS.

But in case you wanted to center a div with unknown width you can use this code.