【发布时间】:2014-01-06 18:55:11
【问题描述】:
有没有办法自动检测内容何时侵犯页边距,然后使用 CSS 强制分页?我有一个有边框和一些内容的 DIV:
<div id="container">
This content could spill into the bottom margin of the printed page....
</div>
CSS:
#container {
border: 2px solid black;
}
是否有 @print 规则可以执行以下操作:
+----------+
| |
| page 1 |
| |
| content |
| |
| this over|
+----------+
+----------+
|flows and |
|the CSS |
|makes a |
|new page |
|with a |
|border |
+----------+
如果可能的话,我想避免编写手动强制中断的规则,一个好的解决方案应该(一直)回到 IE8/旧版 Firefox。谢谢!
【问题讨论】:
-
你试过用谷歌搜索这个吗? davidwalsh.name/css-page-breaks
-
是的,我已经登陆了。他似乎使用 .page-break 类选择器手动强制分页,这是我试图避免的。