Solve the problem that only one page can be recognized when right-clicking to print html

Hello, long time no see, I encountered a problem in the development yesterday, that is, I right-clicked on the webpage I developed --> print, because the content of the page is too much, the printed content is only recognized as one page.

In response to this problem, I checked a lot of information and finally solved it.

1. Reproduce the problem

        You can see that this is a page developed by us. The company needs to print this html for another platform to use, but because the page length has scroll bars, it should be recognized as multi-page under normal circumstances.

But it is recognized that there is only a single page and cannot be scrolled

 So I went to look at the printing of station b, station b can print and identify multiple pages

 2. Solutions

  This problem was really a headache at the time. After reading various solutions, some said that the big manufacturers have done special processing for printing, and needed js packages to control it.

But! It's not that complicated, we just need to adjust our styles.

The main reason is that when printing, the system will recognize the height of the page. If you set a fixed height of 100% for your body, then only the first page can be recognized.

So, we have to set the height of the body to auto

 

 Now let's try to print it again:

 Well, the problem is solved.


Hurry up and practice, brother dei, if you don't practice, you will be useless!

Remember to support me, okay, I wish you good things in pairs~~~~~~

Guess you like

Origin blog.csdn.net/Yan9_9/article/details/132312119