I believe this task may require JavaScript, but I'm uncertain about how to approach it. Is there a method that can determine whether my div element will be displayed on one page or split across two pages based on my print settings in print.css?
My goal is to ensure that if the element fits entirely on one page, it remains unchanged. However, if it extends onto two pages, I want it to be shifted to the next page to avoid being divided. This method is necessary because when I create different elements using JavaScript with varying sizes, they often do not all fit on a single page and need to be moved to the following page.
For example, let's consider elements A, B, and C. Elements A and B fit on the first page, but for elements A and C, element C ends up splitting between pages 1 and 2. In such cases, I would like the script to recognize the split and relocate it entirely to the next page (page 2).
English is not my native language, so I apologize if my explanation is unclear. Feel free to ask questions in the comments, and I will provide further clarification.