Search code examples
htmlcssprintingpage-break

Page break not breaking


I want to have page break but it is not working. I tried to post the whole code but it exceed number of characters. I wanted to know what may cause page break not to work.

@media print {
    div.pagebreak {
        display: block !important; 
        page-break-after: always; 
    }
    .dontprint{ 
        display : none
    }
    body{
        display: block;
    }

}
<tr ><td><div class="pagebreak"></div></td></tr>


Solution

  • I found the answer

    display: flex;
    justify-content: center;
    font-size: 10px;
    

    I have this in my parent div as style when i remove it it works. Although i dont know why. I hope someone has the answer why this style is not letting the page break to work