10

With the advent of HTML5, I'm starting to use figure to enclose images and tables, among other things. Up until now I've used the table's caption element to label the table. However, figcaption can be used to label the figure's content. It seems that in the case of a table within a figure, there are two elements that serve more or less the same purpose.

On one hand, caption is specific to describing the table's purpose; on the other hand figcaption is a little broader, yet would apply to the table as well as other figure content.

Would it be appropriate to use figcaption to label tables in figures, if for nothing else than consistency with other figures containing different elements?

1 Answer 1

12

From the WHATWG spec:

When a table element is the only content in a figure element other than the figcaption, the caption element should be omitted in favor of the figcaption.

And while they currently match, here's a corresponding link to the W3C Editor's Draft, just in case.

1
  • 1
    This seems to have a curious consequence when dealing with HTML within EPUBs. Some ereader software/hardware seems to have some kind of 'view table' functionality that opens just a table, I assume for potentially better viewing. But when following this recommendation this results in the caption being detached from the table in the readers I have tested it with (Kindle and Calibre, though not Adobe Digital Editions which doesn't seem to have this 'view table' functionality).
    – Joey Sabey
    Apr 24, 2019 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.