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
https://forums.phpfreaks.com/topic/102685-centralising-the-page/
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.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.