Wednesday, January 5, 2011

Creating a HTML DIV that adjusts its size to automatically fit the content

To create a div that automatically adjusts its size to fit the content, use this in your CSS:
margin: 0 auto;
Using 'margin' for this purpose doesn't seem particularly intuitive to me, and isn't mentioned in CSS doco I read, but it works.

No comments: