Close this search box.

text-align: center; not working in Firefox

I have the following scenario:

  text-align: center;
  border: solid 1px blue;
<div class=container><table><tr><td>Text</td></tr></table><div>

In IE (6) this displays as you would expect (with the table centered).  However with Firefox (1.5) the table is left aligned.

Apparently this is due to a bug with the way FF handles CSS.

The workaround is to use this:

  text-align: -moz-center;

instead of

  text-align: center;

Don’t ask me why “-moz-center” even exists  – it’s like they thought ‘hey center doesnt work – lets make up our own version of it.. duh!

Oh well – at least  it works (sort of).



This article is part of the GWB Archives. Original Author: Tim Huffam

Related Posts