Help - Search - Members - Calendar
Full Version: Caption element not centered correctly
HTMLHelp Forums > Web Authoring > Cascading Style Sheets
Daniel
See http://www.danielbridges.info/pages/contact.shtml

... any idea why the caption is not centered like everything else?
pandy
It is... but not in FF. Browsers may align the caption differently, but it looks like FF places it outside the table and independent of the table. I've never noticed this before. How queer. unsure.gif

Add this and you can see what FF is doing.
CODE
caption    { border: 2px solid red }

The caption has the same width as the table but is displayed outside the table. Peculiar. Is this how it's supposed to be, I wonder?

Anyway, centering it fixes the problem...
CODE
caption    { margin: auto }
Christian J
According to http://www.w3.org/TR/CSS21/tables.html#model and especially the image: http://www.w3.org/TR/CSS21/tables.html#img-top-caption it seems the CAPTION should depend on the table's location: "the table box generates an anonymous box that contains the table box itself and any caption boxes".
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.