CSS container tricks

In CSS I always forget that when creating a box to put things in you want the box to expand with the contents that are inside of it.  The secret to this I found out last year was to put overflow: auto in.

Example:

The other trick was to put margin: 0px auto.  That makes the element float in the middle of a page.  This is the standard container CSS that I use.

Comments are closed.