Splitting HTML page so Printer splits it into separate pages

喜夏-厌秋 提交于 2019-12-06 00:59:59

问题


I am planning price list available for clients online and I was thinking about simple very long page or div container with some anchor links aside to help jump to different products.

However in case someone wants to print off just price list with certain products I don't want all the pages to print off but only current one. Is there any print breaking character or tag?

Just in case someone has better idea all I want to achieve is having price list in html to change it in one place but still be able to convert separate product price lists into PDF files for emailing purposes of particular product.


回答1:


Use this CSS:

@media print
{
      .page-break  { display:block; page-break-before:always; }

}

and then cite this in your HTML where you want the page to break:

<div class="page-break"></div>

And there you go :)



来源:https://stackoverflow.com/questions/14686883/splitting-html-page-so-printer-splits-it-into-separate-pages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!