On 4/4/08, Yuri <[EMAIL PROTECTED]> wrote:
> A newbie question:
>
> I am trying to center a DIV block without specifying its width
> explicitly: I'd like the width to depend on DIV's contents. I set
> 'display' property to 'table' as shown below:

In a sense, yes, you can center block-level elements without
explicitly declaring a width. However, you would never know it because
block-level elements are as wide as their container elements unless a
width is explicitly declared in some fashion.

See http://www.w3.org/TR/CSS21/visuren.html#block-formatting

If you want the text (and other inline elements) inside this DIV to be
centered you could set text-align to center. However, I'm guessing you
don't want that precisely. I'm not sure I understand why you wouldn't
want to set a width explicitly if you know you want it to be centered.

Oh, and the display: table settings are not very well supported at the
moment. I'd steer clear of them for now.
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to