Solved

Centering Page

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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 …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now