开发者

Table caption element is causing page to break when printing

Consider 开发者_StackOverflow中文版the following table:

<table>
<caption>The caption</caption>
<thead>...</thead>
<tbody>...</tbody>
<tfoot>...</tfoot>
</table>

The table renders right when displaying on screen, but when printing it breaks the table for a new page. When I delete the caption element or display:none, the table renders right on printing.

Any help?


According to W3C:

The table elements, table, tr, td, th, and caption, should have their standard meaning and display treatments: table, table-row, table-cell, and table-caption.

From my understanding this means

caption { display: table-caption; }

EDIT: I found a more accurate style:

TABLE         { display: table }
TR            { display: table-row }
THEAD         { display: table-header-group }
TBODY         { display: table-row-group }
TFOOT         { display: table-footer-group }
COL           { display: table-column }
COLGROUP      { display: table-column-group }
TD, TH        { display: table-cell }
CAPTION       { display: table-caption }

Please tell me if this works for you.

For more detailed information about the topic, visit THIS PAGE

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜