Jump to content

Centralising The Page


stublackett

Recommended Posts

Hi,

 

I've got a Holding DIV Tag which holds the full page in the middle horizontally, What I would like to know is how do I also get it to fit Vertically aswell?

 

I've currently got the code for it Horizontally as

#container {
position:relative;
margin: 0 auto;
width:1024px;
height:768px;
}

 

I just need to get it in the centre as you look from the top of the page aswell, Any help appreciated

Cheers

Link to comment
Share on other sites

here is how:

 

HTML CODE

<html>
<body><div id="wrapper"></div></body>
</html>

 

CSS:

body{text-align:center;}

#wrapper{margin:0 auto; text-align:left; width:780px; height:500px;}

 

This will center the page horizontally - but NOT VERTICALLY. You cannot center vertically! This is not supported by w3c. It is not possible. However you can add a margin to the top of the wrapper div by using the fllowing style:

 

#wrapper{margin:0 auto; text-align:left; margin-top:100px; width:780px; height:500px;}

 

later. Aled.

 

P.S. Replied to your post because no one replied to mine yonks ago when I asked the same question. ::)

p.p.s  You don't need to position your wrapper relative to the view portal. That much is done automatically.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.