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

Re: Re:Re: How is it possible to devise such a feeble system?

From: Håkon Wium Lie <howcome@opera.com>
Date: Thu, 25 Oct 2001 01:51:15 +0200
Message-ID: <15319.21491.310000.296168@gargle.gargle.HOWL>
To: Andrew McFarland <andrew.mcfarland@unite.net>
Cc: www-style@w3.org
Also sprach Andrew McFarland:

 > What you are wanting to do is center the text vertically in the middle of 
 > the screen (or window). I don't think CSS `knows' what size the screen (or 
 > window) is.

MOst of the CSS formatting model deals with elements (and their
associated boxes) and not the viewport (a.k.a. window). There is one
exeption, though. "Fixed positioning" lets you place elements w.r.t
the viewport. Here is a simple example on how to "center" content in
the window:

  #foo {
    position: fixed;
    top: 40%;
    height: 20%;
    width: 100%;
    text-align: center;
  <DIV id="foo">

"Fixed positioning is supported by Opera and Mozilla.

It's not true centering vertically since the height DIV's content
isn't taken into the calulation. 

              Håkon Wium Lie                          cto °þe®ª
howcome@opera.com                  http://people.opera.com/howcome
Received on Wednesday, 24 October 2001 19:54:47 UTC

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