how to center my webpage?, how to center my webpage? |
how to center my webpage?, how to center my webpage? |
wasku |
Jan 3 2007, 08:42 PM
Post
#1
|
Group: Members Posts: 1 Joined: 3-January 07 Member No.: 1,449 |
Hi, I have designed a site. I would really like it to be centered in the browser instead of always aligned to the left. (so that when you resize, the whole page moves to the center even though it maintains its fixed width)
This site manages to do it: http://www.armageddongames.net/zeldaclassic/index.php How can I do it? I used Microsoft Frontpage to build my site. Thank you!! |
pandy |
Jan 4 2007, 03:29 AM
Post
#2
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,733 Joined: 9-August 06 Member No.: 6 |
It depends a little in how you have built your page. Could you link to a sample page, please?
A common way to center a block is to use equal left and right margins. If the width is known 'auto' can beused as the value. |
john f |
Jan 4 2007, 04:44 PM
Post
#3
|
Member Group: Members Posts: 47 Joined: 23-August 06 Member No.: 10 |
To counter problems in Explorer 5/5.5 add text-align:center to body in your style sheet.
<style type="text/css"> body {text-align:center.............................................................} #container { width: 90%; margin: auto; background-color: #fff; color: #333; border: 1px solid gray; line-height: 130%;} </style> <body> <div id="container"> Container div....................................................</div> This post has been edited by john f: Jan 4 2007, 05:01 PM |
john f |
Jan 4 2007, 04:56 PM
Post
#4
|
Member Group: Members Posts: 47 Joined: 23-August 06 Member No.: 10 |
Also add to your style sheet p{text-align:left} to ensure that paragraphs are aligned left. This is to counter the problem created by adding text-align:center to body in stylesheet
|
Frederiek |
Jan 5 2007, 05:44 AM
Post
#5
|
Programming Fanatic Group: Members Posts: 5,146 Joined: 23-August 06 From: Europe Member No.: 9 |
For more info and probably better explanations, go see one of the links at Positioning & Layout and then Centering.
|
Lo-Fi Version | Time is now: 27th April 2024 - 10:02 PM |