How Do I Center a Site Built with CSS Positioning??

Need technical advice on coding your web pages? Covers HTML, JavaScript, CSS, and some server side technologies. Also the issue of some webpages not displayed well.

Moderator: Don_HH2K

How Do I Center a Site Built with CSS Positioning??

Postby okorosi » Sat 13 Mar, 2010 10:33 pm

I built a site using CSS absolute positioning to layout all of the elements, but am now wanting to center the pages in the browser window. How do I accomplish this? Please help!
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8 (.NET CLR 3.5.30729)
okorosi
new member
new member
 
Posts: 2
Joined: Sat 13 Mar, 2010 10:26 pm

Postby Antony » Sat 13 Mar, 2010 11:43 pm

There are two methods with absolute positioning.

1) obtaining inner window size through JavaScript, and use JavaScript to calculate the positioning.

2) Put all your absolute positioning inside a layer (DIV), and have that DIV centred.
UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6
User avatar
Antony
diamond member
diamond member
 
Posts: 14930
Joined: Tue 18 Jun, 2002 11:36 pm
Location: Sydney, Australia

Postby okorosi » Sun 14 Mar, 2010 1:39 am

I'll give this a try, thanks!!
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8 (.NET CLR 3.5.30729)
okorosi
new member
new member
 
Posts: 2
Joined: Sat 13 Mar, 2010 10:26 pm


Return to Web Design and Page Coding

Who is online

Registered users: Bing [Bot], Google [Bot]