Amol Patil
Amol Patil

Reputation: 1005

CSS page-break not working

I am using "page-break-after" attribute on div.

The CSS class -

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

and the div in the page is



 <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.

enter image description here

What actually I am doing wrong? Thanks in advance.

Upvotes: 0

Views: 1148

Answers (1)

Amol Patil
Amol Patil

Reputation: 1005

I solve the problem.

Problem is the float left in the fancyTable class -- .fancyTable { height: 100px; float: left; }

I just nest the tables instead of giving them width 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>

Upvotes: 2

Related Questions