stublackett Posted April 24, 2008 Share Posted April 24, 2008 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 Quote Link to comment Share on other sites More sharing options...
Voodoo Jai Posted April 24, 2008 Share Posted April 24, 2008 Not sure myself but is setting left & right margins to "auto" the way. Me learning as well Quote Link to comment Share on other sites More sharing options...
aled Posted April 29, 2008 Share Posted April 29, 2008 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. Quote Link to comment Share on other sites More sharing options...
GameYin Posted April 29, 2008 Share Posted April 29, 2008 Not true. Position: static; is default. Not position relative. Quote Link to comment Share on other sites More sharing options...
stublackett Posted April 29, 2008 Author Share Posted April 29, 2008 Cheers gents, Will try that! I've actually done it temporarily at the moment by positioning it from the top x amount of pixels from the top, Seems to have done the trick, But a pain in different resolutions Quote Link to comment Share on other sites More sharing options...
GameYin Posted April 29, 2008 Share Posted April 29, 2008 You shouldn't use pixels. Use %'s Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.