html - -CSS and Printing Web Pages, page-break-inside: avoid; - not working for me - -


i trying have contents of web page print onto 1 page of paper. but, breaking content 2 pages, did research here , see people recommending:

<style type="text/css" media="print">  #my_print_div{ width:940px; height:770px; page-break-after: always; /* insert page break after element */ page-break-inside: avoid; /* please don't break page content browser */ }  </style>  <div id='my_print_div'> content printed here</div> 

my div still breaks , carries on next page print - unless select "shrink fit" - in mozilla firefox.

  • is there way make sure content of div not print on 2 pages? want force content 1 printable page

  • is there known pixel width height match landscape 11 inch 8.5 inch letter size paper?

thank you

the point of page-break properties not shrink content fit on page, decide optimal place page break occur.

so, if use page-break-inside:avoid on element, , there's not enough space on current page fit entire element, browser consider inserting break force element onto new page, theoretically giving more space.

however, if element big moving onto new page won't help, there's nothing done (in terms of page breaks @ least).

if know in advance content need shrunk when printing, try adding scale transform on problem elements (restricted print media type), they're more manageable size.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -