...

View Full Version : Looking for CSS container element that terminates like a table cell



creativeguy
11-01-2006, 12:38 AM
I'm looking for a CSS element that behaves like a table, where the size of the container will always be just big enough to surround the data inside, and will grow or shrink based on the content inside without having to specify any widths or heights.

A div (with a border) with no width specified will go on forever horizontally. A table (with a border) with no width will stop as soon as the data inside ends.

Is there a way to simulate this table behavior using CSS?

Thanks

harbingerOTV
11-01-2006, 01:31 AM
well, a
<span> will do that. What your looking for is an inline element. divs, being block level will always be 100% as wide as thier container unless told otherwise.

ez4me2c3d
11-01-2006, 01:34 AM
Not sure, but what are you doing that you can't use a table?

ez4me2c3d
11-01-2006, 01:35 AM
well, a
<span> will do that. What your looking for is an inline element. divs, being block level will always be 100% as wide as thier container unless told otherwise.

Within a TD if you put a BR then the box drops to contain the text, a span will break.

creativeguy
11-01-2006, 01:46 AM
I can use a table, but am trying experience that wonderful (or not so) world of pure css.

It looks like "display:table" "display:table-cell" "display:table-row", is what I need to get multiple rows to line up nicely, but IE6 and 7 (surprisingly) don't support any of those attributes, so there is no point in using them if 90% of the world can't see them. I'll just use a table.

Thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum