如何保留从 IE 打印时,元素会出现在多个页面上吗?
我有一个 HTML 数据表,其中每个单元格可以有多行文本。 打印表格时,一行可能会被分解,以便一些数据出现在第一页的底部,而一些数据出现在下一页的顶部。 是否有类似于 Word 的“保持在一起”功能可以防止表格行内发生分页? 我认为这将是一个常见问题,但我能找到的唯一“答案”隐藏在某个连字符的网站上。 :)
更新: 数据将使用 IE 7 查看,它似乎无法正确处理“page-break-inside”属性(如果有的话)。 还有其他选择吗? jQuery 可以帮助解决这个问题吗?
I have an HTML table of data where each cell can have multiple lines of text. When the table is printed, it's possible for a row to be broken up so that some of the data appears at the bottom of the first page and some appears at the top of the next. Is there an equivalent to Word's "keep together" functionality that will prevent a page break from happening within a table row? I would think this would be a common problem, but the only "answer" I could find was hidden on a certain hyphenated web site. :)
Update:
The data will be viewed using IE 7, which it appears does not handle the "page-break-inside" property correctly (if at all). Are there alternatives? Is this something jQuery can help with?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试:
CSS2 友好的方法是
td { 分页内部:避免; }
请参阅 page-break-inside 定义
来自:http://channel9. msdn.com/forums/TechOff/35322-Keep-with-next-when-printing-HTML-tables/
try:
The CSS2-friendly way to do it would be
td { page-break-inside: avoid; }
see the page-break-inside definition
from: http://channel9.msdn.com/forums/TechOff/35322-Keep-with-next-when-printing-HTML-tables/
您可以使用 CSS 媒体类型来创建适合打印的页面。 下页给出了一个简单的示例。 我相信它会帮助你解决问题。
http://martybugs.net/articles/print.cgi
You may use CSS mediatypes to create printer friendly pages. A simple example is given in the following page. I believe it would help you solving the problem.
http://martybugs.net/articles/print.cgi