[thelist] Self-sizing element you can style

Dave Merrill dmerrill at usa.net
Sun Dec 4 06:31:23 CST 2005

Basic question I'm afraid I know the answer to...

What cross-browser html element(s) or css settings are there that auto-size
themselves to multi-line text content, and can be styled with a background
color and/or border? The only one I can think of is a one-cell table.

Divs (anything block) extend the full width of their containing element.
Spans (anything inline) do silly things with multi-line text when you give
them a border and background.

Display: table is ok in Mozilla, but IE doesn't honor it. Display:
inline-block is ok in IE but not Mozilla. Any other ideas, outside of using
conditional comments or browser sniffing to switch between those two display

Seems like such a simple requirement, it'd be unfortunate go back to tables
just to achieve it, but nothing else occurs to me.

What am I missing?


Dave Merrill

More information about the thelist mailing list