Solved

How to center content (body, div, td, etc) for FF3 & IE7?

Posted on 2008-10-07
2
1,342 Views
Last Modified: 2009-05-26
I've been searching for a while today and cannot seem to find the right answer. I am trying to center some elements (body, div, td, etc) for FF3 and IE7.

The doc type I am using is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

The CSS version is 2.1

The CSS works fine in IE7 and mostly works in FF3, except for the centering.

I have tried "margin: auto;", "margin: 0 auto;", "margin-left: auto;", "margin-right: auto;" in addition to "text-align: center;" and I also tried setting the div width to 100% along with these attempts.

I tried on the elements themselves as well as the parent elements.

So... now what? Also, if anyone has a link to a read-able and manageable reference to CSS in FF, that would be great.

Thanks.
0
Comment
Question by:xizwyck
2 Comments
 
LVL 3

Author Comment

by:xizwyck
ID: 22661041
This is frustrating. No matter what I do, I can't get FireFox to center anything - isn't this SUPPOSE to be a better browser?
0
 
LVL 14

Accepted Solution

by:
EMB01 earned 100 total points
ID: 22662046
This is how I center mine:
body { text-align: center; }
div#container {margin: 0 auto; }

Now, just put your content inside the container .DIV. That worked for me on my last cross-browser test...
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

Title # Comments Views Activity
CSS Scroll Issue 3 90
Footer at the bottom of the page not centered 5 29
P tag not forcing line space 2 23
To remove highlight from a "a href" 5 23
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

920 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

15 Experts available now in Live!

Get 1:1 Help Now