Solved

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

Posted on 2008-10-07
2
1,341 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

CSS3 Custom checkboxes This article shows how to style the checkbox form element using only CSS. Works in: Chrome, FF, Safari, Opera, IE9+ Uses modernizr.js to check for :checked pseudo class, falling back to plain old checkboxes (IE8 and bel…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…

706 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

18 Experts available now in Live!

Get 1:1 Help Now