简体   繁体   English

CSS分页符不起作用

[英]CSS page-break not working

I am using "page-break-after" attribute on div. 我在div上使用“ page-break-after”属性。

The CSS class - CSS类-

div.breakhere {
    page-break-after: always;
    margin: 0! important;
    width: 100%;
}
.fancyTable {
    height: 100px;
    float: left;
}

and the div in the page is 并且页面中的div是



 <div id="summary" width="100%">
        <table class="fancyTable" width="50%" ></table>
        <table class="fancyTable" width="50%"></table>
    </div>
    <div class="breakhere"> </div>

---- ----

It's working perfectly except following case. 除以下情况外,它运行正常。

  • When "The div with id 'summary'" exactly before "The div with breakhere class" come at the end of page. 当恰好在“具有breakhere类的div”之前的“具有id'summary'的div”位于页面末尾时。 Part of the div and tables printed in the next page. 下一页的div和表格的一部分。 The next page is not break by breakhere class. 下一页不是按breakhere类中断的。 Please check the following screen. 请检查以下屏幕。

在此处输入图片说明

What actually I am doing wrong? 实际上我在做什么错? Thanks in advance. 提前致谢。

I solve the problem. 我解决了问题。

Problem is the float left in the fancyTable class -- .fancyTable { height: 100px; 问题是fancyTable类中的浮点数-.fancyTable {height:100px; float: left; 向左飘浮; } }

I just nest the tables instead of giving them width 50%. 我只是嵌套表格而不是给它们提供50%的宽度。 like - 喜欢 -

<div id="summary" width="100%">
    <table>
        <tr>
            <td><table id="table1" class="fancyTable" width="50%" ></table></td>
            <td><table id="table1" class="fancyTable" width="50%" ></table></td>
        </tr>
    </table>
</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM