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

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:

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

"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
              Håkon Wium Lie                          cto °þe®ª
howcome@opera.com                  http://people.opera.com/howcome

Received on Wednesday, 24 October 2001 19:54:47 UTC