Re: Block element width behavior

On Friday 14 March 2003 10:26 pm, Stuart Ballard wrote:

[no way of making block elements 'auto' width]

> I don't object to this default behavior, but the problem is that as far
> as I can tell there's NO WAY to style a div to behave like the table
> cell does by default. Which forces me to use horribly un-semantic tables
> for simple blocks that don't need any tabular behavior except for the
> ability to calculate their width based on their content.

div {
	display: table;
}

does what you want, but isn't very well supported by user-agents.  A better 
workaround than using tables in many cases is using something like 
<div><span>...</span></div>, and styling the span.

I do think that there should be a more intuitive way of doing this though, I'm 
unaware of the state of this in the css 3 drafts.

-- 
Jim Dabell

Received on Friday, 14 March 2003 17:36:36 UTC