Sent by David Laakso on 28 April 2010 19:07
Jess Jacobs wrote:
> 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?
>
All in all simultaneous vertical/horizontal centering is at best
difficult and the solutions are easily broken by users. This article by
Georg Sortun provides both insight and solution but in my opinion you
are best using it, or any such method, with due caution...
<http://www.gunlaug.no/contents/wd_additions_20.html>
> 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.
>
This is problematic in any vertical centering situation primary because
of user discretion to scale fonts, and/or not have the window fully open
vertically, and so on...
> Thoughts?
>
> ========================
> Jess Jacobs
>
>
~d
--
desktop
http://chelseacreekstudio.com/
mobile
http://chelseacreekstudio.mobi/
______________________________________________________________________
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/