HTML:IE9标准模式在每页上打印TFOOT

发布于 2024-10-21 06:24:56 字数 3003 浏览 2 评论 0原文

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-groupTFOOT 元素的典型默认值,但在早期版本的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清晨说晚安 2024-10-28 06:24:56

在 HTML 中,行为未定义。浏览器可以:

  • 整个表格之后显示
  • 在每个页面底部显示

。我遇到的问题是在 Internet Explorer 9 候选版本中。

在 Internet Explorer 9 的最终版本(版本 9.0.8112.1642 RTM)中,TFOOT 始终出现在每个打印页面的底部。

在早期版本的 IE 中,您可以选择

  • TFOOT 出现在每个页面的底部
  • TFOOT 出现在表格后面

TFOOT通过手动指定 >TFOOT css style:

tfoot { display: table-footer-group; }

即使tfoot已经具有table-footer-group的显示样式,特别包括它会告诉即您希望将 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-->
   ...

In HTML the behavior was undefined. Browsers could:

  • display after the entire table
  • display at the bottom of each page.

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 page
  • TFOOT appearing after the table

by manually specifying the TFOOT css style:

tfoot { display: table-footer-group; }

Even though tfoot already has the display style of table-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:

<!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-->
   ...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文