<TABLE> <THEAD><TR><TD>Your header goes here</TD></TR></THEAD> <TFOOT><TR><TD>Your footer goes here</TD></TR></TFOOT> <TBODY> <TR><TD> Page body in here -- as long as it needs to be </TD></TR> </TBODY> </TABLE>@H_404_3@通常,旧版Internet Explorer只会在整个表格的底部显示TFOOT.但有一种风格可以应用于TFOOT(和THEAD)使其成为print at the bottom of each page spanned by the table. From MSDN:
table-footer-group
Object is rendered as 07001. Table footer is always displayed
after all other rows and row groups,and before any bottom captions.
The footer is displayed on each page spanned by a table.将表尾页组作为样式添加到TFOOT会导致它(在Internet Explorer中)打印在表所跨越的每个页面的底部:
<STYLE type="text/css"> tfoot { display: table-footer-group; } </STYLE>@H_404_3@但是如果IE9(候选版本)被置于标准模式:
<!DOCTYPE html>@H_404_3@然后TFOOT不再呈现在跨越表的每个页面的底部,而是仅在整个表的末尾.
我检查了the HTML spec以查看正确的行为是什么,并且它未定义!:
table-footer-group (In HTML: TFOOT)
Like ‘table-row-group’,but for visual
formatting,the row group is always
displayed after all other rows and row
groups and before any bottom captions.
Print user agents may repeat footer
rows on each page spanned by a table.
If a table contains multiple elements
with ‘display: table-footer-group’,
only the first is rendered as a
footer; the others are treated as if
they had ‘display: table-row-group’.IE9标准模式中有没有办法让我选择在每个页面底部打印TFOOT?
更新一
有趣的是,table-footer-group是TFOOT元素的典型默认值,但在以前版本的IE中,您可以选择所需的行为:
选择包括风格.
更新二
现在我正在强迫Internet Explorer保持IE8标准模式:
<!DOCTYPE html> <HTML> <HEAD> <Meta http-equiv="X-UA-Compatible" content="IE=8" /> <!--IE8 Standards mode,so that we get the THEAD at the top,and the TFOOT at the bottom,of every page-->@H_404_3@也可以看看
> Is there a way to get a web page header/footer printed on every page?
> MSDN: display Attribute
> W3C CSS2.1: 17.2 The CSS table model
> Printer Friendly Pages With a Header on Every Page?
> table-header-group and table-footer-group in a Div
解决方法
我遇到的行为是在Internet Explorer 9 Release Candidate中.
在Internet Explorer 9(版本9.0.8112.1642 RTM)的最终版本中,TFOOT始终显示在每个打印页面的底部.
在早期版本的IE中,您可以选择:
> TFOOT出现在每个页面的底部
> TFOOT出现在桌子后面
通过手动指定TFOOT css样式:
tfoot { display: table-footer-group; }@H_404_3@即使tfoot已经具有table-footer-group的显示风格,特别包括它会告诉IE你想要在每个页面的底部打印TFOOT. (而不是在桌子之后).
不指定它(默认行为)将使IE在整个表之后打印TFOOT.
如果您使用的是IE9,并希望在整个表格打印后只显示TFOOT,则必须将Internet Explorer置于IE8标准模式:
<!DOCTYPE html> <HTML> <HEAD> <Meta http-equiv="X-UA-Compatible" content="IE=8" /> <!--IE8 Standards mode,so that we get the TFOOT after the entire table has printed,not at the bottom of each printed page--> ...@H_404_3@