Solved

Centering Page

Posted on 2003-11-17
4
237 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

828 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