HTML:IE9标准模式在每页上打印TFOOT
HTML 中的表格可以有“页脚”:
<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>
通常,旧版 Internet Explorer 只会在整个表格的底部显示 TFOOT
。但有一种样式可以应用于 TFOOT
(和 THEAD
),使其打印在表格所跨越的每个页面的底部。来自 MSDN:
表格页脚组
对象呈现为 tFoot。始终显示表页脚
在所有其他行和行组之后以及任何底部标题之前。
页脚显示在表格跨越的每个页面上。
将 table-footer-group
作为样式添加到 TFOOT
会导致它(在 Internet Explorer 中)打印在表格所跨越的每个页面的底部:
<STYLE type="text/css">
tfoot { display: table-footer-group; }
</STYLE>
但是如果 IE9 (< em>release候选)被置于标准模式:
<!DOCTYPE html>
然后TFOOT
不再呈现在跨越表格的每个页面的底部,而是仅呈现在整个表格的末尾。
我检查了 HTML 规范 以查看正确的行为是什么,但它是未定义的!:
表格页脚组(HTML 中:TFOOT)
类似于“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-->
另请参阅
Tables in HTML can have "footers":
<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>
Normally, legacy Internet Explorer would only display the TFOOT
at the bottom of the entire table. But there was a style that can be applied to TFOOT
(and THEAD
) to make it print at the bottom of each page spanned by the table. From MSDN:
table-footer-group
Object is rendered as tFoot. 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.
Adding table-footer-group
as a style to TFOOT
causes it (in Internet Explorer) to print at the bottom of each page spanned by the table:
<STYLE type="text/css">
tfoot { display: table-footer-group; }
</STYLE>
But if IE9 (release candidate) is placed into standards mode:
<!DOCTYPE html>
then the TFOOT
is no longer rendered at the bottom of every page spanning the table, but only at the end of the entire table.
i checked the HTML spec to see what the proper behavior is, and it's undefined!:
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'.
Note: Emphasis added for effect.
Is there a way in IE9 standards mode for me to choose to print a TFOOT
at the bottom of each page spanned by a table?
Update One
It is interesting to note that table-footer-group
is a typical default value for TFOOT
elements, but in previous versions of IE you could choose which behavior you wanted:
- bottom of entire table
- bottom of entire table and every intermediate page
by choosing to include the style.
Update Two
As it is now i am forcing Internet Explorer to remain in IE8 standards mode with:
<!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-->
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 HTML 中,行为未定义。浏览器可以:
。我遇到的问题是在 Internet Explorer 9 候选版本中。
在 Internet Explorer 9 的最终版本(版本 9.0.8112.1642 RTM)中,
TFOOT
始终出现在每个打印页面的底部。在早期版本的 IE 中,您可以选择:
TFOOT
出现在每个页面的底部TFOOT
通过手动指定>TFOOT
css style:即使
tfoot
已经具有table-footer-group
的显示样式,特别包括它会告诉即您希望将 TFOOT 打印在每页的底部。 (而不是在表之后)。不指定它(默认行为)将使 IE 在整个表格之后打印
TFOOT
。如果您使用 IE9,并且希望在打印整个表格后只显示
TFOOT
,则必须将 Internet Explorer 置于 IE8 标准模式:In HTML the behavior was undefined. Browsers could:
The behavior i was experiencing was in Internet Explorer 9 Release Candidate.
In the final version of Internet Explorer 9 (Version 9.0.8112.1642 RTM) the
TFOOT
appears at the bottom of every printed page, all the time.In earlier versions of IE you could choose between:
TFOOT
appearing at the bottom of every pageTFOOT
appearing after the tableby manually specifying the
TFOOT
css style:Even though
tfoot
already has the display style oftable-footer-group
, specifically including it would tell IE you want the TFOOT printed at the bottom of every page. (rather than after the table).Not specifying it (the default behavior) will make IE print the
TFOOT
after the entire table.If you are using IE9, and want to only have a
TFOOT
appear after the whole table has printed, you will have to put Internet Explorer into IE8 standards mode: