Categories
CSS

CSS center stuff with dynamic width

It is not as simple as display: auto, but still pretty simple:

http://solstice.co.il/blog/2008-02-26/horizontally-centering-content-dynamic-width-css

Just in case the source is taken out:

<div>
	<div>
		My Content
	</div>
</div>
.centered{
 	margin-left: auto;
 	margin-right: auto;
 	display: table;
 }

Leave a Reply

Your email address will not be published. Required fields are marked *