Html Page Break not working

前端 未结 2 681
萌比男神i
萌比男神i 2021-01-26 03:12

Trying to set a page break in the page I\'m working on but in the print preview I\'m still seeing things on the page that aren\'t supposed to be there. Can\'t figure out why thi

2条回答
  •  面向向阳花
    2021-01-26 03:47

    Your css needs to be

    hr.applicant-break {page-break-after:always;}
    

    EDIT:

    Doing some reading on the W3Schools website, it seems this css property is meant for table elements

    "Set the page-breaking behavior to always break after a table element"

    EDIT:

    Doing some more reading, it seems browsers do support more than the table element, however some browsers have trouble with it on HR and BR tags (Reading here)

    try putting a div after the hr like so


    and changing your CSS to

    div.applicant-break {page-break-after:always;}
    

提交回复
热议问题