Solved

Centering Page

Posted on 2003-11-17
4
235 Views
Last Modified: 2008-02-26
I have a website done in PHP using div tags.  I want to center the whole page so that if you open it in 1280x680 resolution, etc. the page is in the center of the screen.  I can't use tables because I am pulling a shopping cart into the site.

I have tried several options but it keeps centering the text, picutres & everything.

How can I do this?
0
Comment
Question by:denileigh
4 Comments
 
LVL 13

Accepted Solution

by:
lozloz earned 63 total points
ID: 9767005
why can't you use tables exactly? all you have to do is put at the top

<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td align="center">

and at the bottom you'd have

</td>
</tr>
</table>

then you can pull in your shopping cart as normal?

loz
0
 
LVL 11

Assisted Solution

by:shmert
shmert earned 62 total points
ID: 9767225
You can center the div using CSS, by setting left & right margins to 'auto'.  Or, you can try a percent margin for left and right, which will give you less wasted space on a big screen.

div#content {
    margin: 0 auto;
    - or -
    margin: 0 15%;
}
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PHP & MySQL - Rounding Results from a Select Query 3 25
ebay devID, appID, certID, userToken 2 25
comma true 6 32
PHP Query return divisible by 3 3 15
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question