PDF/WebHelp CSS formatting of table captions
Posted: Tue Jun 21, 2022 8:31 pm
I am finding that table captions are difficult to style with CSS!
Consider a case where:
The figure caption flows fine, but the table caption is wrapped at the table width. (The XSL-FO PDF transformation uses the full width for the caption text.)
The WebHelp output for figure/table captions is as follows:
Somehow the left side of the table caption is clipped. In addition, if I make the browser window narrower (to emulate a tablet or cellphone), the caption text is unwrappable due to a "white-space: nowrap" applied by topic.css, resulting in a scroll bar for only the caption! And that property is there to prevent table captions from wrapping to narrow table widths. So, the choice for table captions seems to be either too-narrow table titles or too-wide table titles.
The troublemaker here is CSS itself; PDF Chemistry and WebHelp are simply following the rules.
My questions are,
1. For PDF and WebHelp output, is there a CSS trick for table captions to naturally use the available width, as figure captions do?
2. For WebHelp output, is there a CSS trick to prevent left-shifted table captions from being clipped?
For #2, interestingly the merged HTML from PDF Chemistry does not clip the caption, but I haven't figured out the CSS setting that makes that happen.
Testcase (publish the "project.xml" file):
Consider a case where:
- The CSS styling moves figure and table captions 0.5in to the left.
- Caption text might sometimes be long.
The figure caption flows fine, but the table caption is wrapped at the table width. (The XSL-FO PDF transformation uses the full width for the caption text.)
The WebHelp output for figure/table captions is as follows:
Somehow the left side of the table caption is clipped. In addition, if I make the browser window narrower (to emulate a tablet or cellphone), the caption text is unwrappable due to a "white-space: nowrap" applied by topic.css, resulting in a scroll bar for only the caption! And that property is there to prevent table captions from wrapping to narrow table widths. So, the choice for table captions seems to be either too-narrow table titles or too-wide table titles.
The troublemaker here is CSS itself; PDF Chemistry and WebHelp are simply following the rules.
My questions are,
1. For PDF and WebHelp output, is there a CSS trick for table captions to naturally use the available width, as figure captions do?
2. For WebHelp output, is there a CSS trick to prevent left-shifted table captions from being clipped?
For #2, interestingly the merged HTML from PDF Chemistry does not clip the caption, but I haven't figured out the CSS setting that makes that happen.
Testcase (publish the "project.xml" file):