A div, like any block level element, will expand horizontally to fill its container. The only times a div will shrinkwrap is if it is floated or positioned absolutely, both of which take the div out of the normal document flow.
You can force a horizontal line with white-space:nowrap. The div will only expand with contents if it is floated or absolutely positioned (with no width set). If the div has a fixed width, contents that are too wide will spill out side the div (except in that POS IE6). Overflow:auto will produce scrollbars if necessary.