for some reason
the width of the div is 100% and if i set it to auto, nothing changes. tried display: block;
and still nothing.
what I have in
Setting width:auto;
is close to the same as setting width:100%;
(the only real difference is that they handle margin and padding differently).
Also, div
objects are by default block elements, so setting display:block;
won't change their behavior.
You said you want the div to take up the width of the words. To do that you can either set display:table-cell
(which is not very IE friendly) or you can float the div and it will snap to fit the contents inside.
.box { float:left; }
Make sure to properly clear your float after the div to avoid breaking the layout of contents below it.
.clear { clear:both; height:0px; }