Click to See Complete Forum and Search --> : Centred Div (Horizontally+Vertically)


Dysan
02-22-2008, 09:15 AM
Hi,

How do I centre a div, and always keep a 18px gap at the top of the page (before content start) when the browser window is resized?

The-Master
02-23-2008, 04:11 PM
<style type="text/css">
div {padding: 18px;}
</style>
Should work.

Dysan
02-24-2008, 10:06 AM
How do I also centre he div horizontally as well as vertically?

The-Master
02-26-2008, 01:41 PM
I don't really know what you mean. So you just want a div placed exactly in the middle of the page or you want a div that has an 18px gap from the side of the page no matter how big the browser window is?

Dysan
02-26-2008, 10:47 PM
I want to try and do what yell.com (http://yell.com) does. Centre a div vertically and horizontally on the page regardless of the window site.

Weedpacket
02-27-2008, 12:43 AM
Then have a look at yell.com and see how they do it. (You know, the same that's been suggested when you asked about how paypal did what they do.)