div tag not centering in firefox

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?

Starr DuskkASP.NET VB.NET DeveloperAsked:
Who is Participating?
dsackerConnect With a Mentor Contract ERP Admin/ConsultantCommented:
Use ...

    <div align="center">

This will center in all browsers.
Starr DuskkASP.NET VB.NET DeveloperAuthor Commented:
sure enough. thanks!
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%;">
b0lsc0ttIT ManagerCommented:
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.