Possible Duplicate:
How can I center something if I don't know ahead of time what the width is?
I want to know how to align a div tag withought knowing a width. This is different to other questions as I would not mind using the <center> tag but it seems to be 'old' in the HTML groups view. Will the <center> tag still be working in the future?
Thanks
I usually use width:auto or width:100% than margin:0 auto;
However you can see the details on the link below as its almost the same question as yours!
How can I center align a div without knowing the width?
Blocks elements are centered by setting left and right margins to auto.
margin-left: auto;
margin-right: auto;
<center> work continue to work for the foreseeable future, so there is no technical reason not to use it, however in modern web development one should acknowledge the principle of "separation of presentation and content" and use HTML for semantics and CSS for layout.
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