document updated 12 years ago, on Oct 2, 2012
Most block-level elements will use up the full width of the browser by default. (eg. <div>, <pre>, ...) This isn't necessarily apparent until you apply a background-color or border to it.
What if you don't want it to be full-width, what if you only want it to take up as much space as is necessary?
- very good article
- stackoverflow
- if you use float:left, you can use a clearfix to always clear after the element
- getting IE7 and IE6 to support inline-block: