Firefox ignores absolute positioning in table cells

Variant picture Variant · Jan 9, 2012 · Viewed 10.7k times · Source

I am trying to absolutely position an element inside a table cell. The TD has position:relative and the element has position:absolute.

This works great in all browsers except in Firefox where it is positioned relative to an ancestor relative container.

You can see this reproduced in this fiddle: http://jsfiddle.net/ac5CR/1/

Does anyone know if I miss some CSS setting that can fix that in Firefox?

Answer

banners picture banners · Jan 9, 2012

the element is not a block element. add to the style display:block, you will get the needed behavior.