469,631 Members | 1,147 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,631 developers. It's quick & easy.

having something in the middle of the screen.....


Hi,

I would like to position a site in the "middle" of the screen, both
horizontally and vertically.

I would do this by having a "wrapper" div with

{
left: 50%;
top: 50%;
margin-top: - [half the height];
margin-left: - [half the width];
}

This works fine, EXCEPT when the browser viewable area is smaller than
the width or the height of the wrapper. In this case, what I would
like to happen is that the wrappers sits against the top or the left
of the viewable area and that a scrollbar helps the user to see the
parts of the screen that are cut off.....

In the old days, with tables, you could achieve just this by having a
table as wrapper. The code goes something like this:

<table width="100%" height="100%">
<tr valign="middle">
<td align="center">
inner div with your actual website.....
</td>
</tr>
</table>

How can I achieve the ideas above without using a table???? or should
I just use a table.

Thank you

Jul 21 '07 #1
2 3081
Ben C wrote:
>
position: absolute;
left: 0; right: 0; top: 0; bottom: 0;
Note that IE doesn't grok this. IE6 doesn't for sure. I don't know if it
was fixed in IE7, but I suspect not.

--
Berg
Jul 21 '07 #2
On Jul 21, 11:31 pm, Bergamot <berga...@visi.comwrote:
Ben C wrote:
position: absolute;
left: 0; right: 0; top: 0; bottom: 0;

Note that IE doesn't grok this. IE6 doesn't for sure. I don't know if it
was fixed in IE7, but I suspect not.

--
Berg
Hi,

Thanks for all your replies. I get the feeling that basically, the
best solution is to keep using the old table system, because if IE6
does not support it then you can't really use it yet - right?

Thank again for all your replies.

Nicolaas

Jul 21 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Tim Streater | last post: by
5 posts views Thread by luke | last post: by
reply views Thread by JasonP | last post: by
8 posts views Thread by Vmz | last post: by
reply views Thread by Jordi Rico | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.