Solved

div tag not centering in firefox

Posted on 2007-11-22
4
716 Views
Last Modified: 2008-02-01
I have a div tag that is set to center my log in control and it works in IE, but left aligns in firefox:

    <div style="text-align: center">

How do I get that panel to center in firefox too?

thanks!
0
Comment
Question by:BobCSD
4 Comments
 
LVL 20

Accepted Solution

by:
dsacker earned 500 total points
Comment Utility
Use ...

    <div align="center">

This will center in all browsers.
0
 
LVL 1

Author Comment

by:BobCSD
Comment Utility
sure enough. thanks!
0
 
LVL 1

Expert Comment

by:edenmachine
Comment Utility
Alternatively you can just make the div 100% in width so that the text can center inside of it:

<div style="text-align: center; width:100%;">
0
 
LVL 54

Expert Comment

by:b0lsc0tt
Comment Utility
You should use style.  The align attribute is deprecated.  However depending on what your "log in control" is the text-align: center style may not work; it is just for text.  An alternative is to make the div the size of the control and then use margin.  This will actually center the div itself in the page, not just the contents.  For example ...

<div style="width: 150px; margin: 0 auto;">

The key to the centering is the limited size (i.e. not 100% and the auto for the left and right side of the margin.

bol
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

Title # Comments Views Activity
jQuery or CSS 9 37
Duplicate a row 2 28
CSS Columns on Slider Mobile 4 21
Different Delete Messages 7 4
As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

763 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

6 Experts available now in Live!

Get 1:1 Help Now