• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 779
  • Last Modified:

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?

thanks!
0
Starr Duskk
Asked:
Starr Duskk
1 Solution
 
dsackerContract ERP Admin/ConsultantCommented:
Use ...

    <div align="center">

This will center in all browsers.
0
 
Starr DuskkASP.NET VB.NET DeveloperAuthor Commented:
sure enough. thanks!
0
 
edenmachineCommented:
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
 
b0lsc0ttCommented:
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now