Previous Message
Next Message

height and margin: auto 0

Sent by Jess Jacobs on 28 April 2010 18:06


This might be a stupid question, but here goes:

I have a div. I can set a width on that div and set margin: 0 auto; and have
the thing centered horizontally.

If I instead set a height on the same div, and then set margin: auto 0; it
does not center horizontally.

Why? why why why?

Would the block center vertically if the containing block had a declared
height, or does that not matter either?

People are increasingly asking me to center things, or make the page
flexible/collapsible, etc, but aren't using any of the kinds of designs that
lend themselves to such things, and I'm not in a position to push back,
unfortunately.

Thoughts?

========================
Jess Jacobs
[EMAIL-REMOVED]
http://www.akisma.com
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
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/
Previous Message
Next Message

Message thread:

Possibly related: