W3C home > Mailing lists > Public > www-style@w3.org > September 2001

vertical centering with CSS2

From: Nolan Clark <nolanc@ischool.washington.edu>
Date: Fri, 31 Aug 2001 20:56:30 -0400 (EDT)
Message-ID: <AACA31416CB5764DA77546B31532C5A7097162@fileserv.ischool.washington.edu>
To: "'www-style@w3.org'" <www-style@w3.org>
I have been unable to figure out how to "vertically center" things using
CSS2. To illustrate what I mean, consider the following:
<div style="width:300">
            <div style="width:20%; margin-left:auto;
That centers the inner div horizontally, but what if I want to center it
vertically? The spec states that for absolutely positioned block level
elements, "margin + padding + height = container height", but it makes no
such requirements on normal, statically positioned blocks. Is there a
different way to do this?
Thanks for any help you can give me,
Nolan Clark
Received on Monday, 3 September 2001 10:45:38 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:59 UTC