简体   繁体   English

如何制作一个不会自行调整大小的div

[英]How to make a div that doesn't resize itself

I have 64 students.我有64名学生。 I want to print a student transcript for each student on one page.I have different number of subjects for different classes.我想在一页上为每个学生打印一份学生成绩单。我为不同的班级设置了不同数量的科目。 When I resize my div for 12 subjects, it fits perfectly thus printing 64 pages but when the subject reduces, it prints lesser pages as the next student details spills on the previous student.当我为 12 个科目调整 div 的大小时,它非常适合打印 64 页,但是当科目减少时,它会打印较少的页面,因为下一个学生的详细信息会溢出到前一个学生身上。 Is there a way to set each div to fully occupy one page by default whether the content is small or big?有没有办法设置每个div默认完全占据一个页面,无论内容是小还是大?

Using the page-break-before property on your div , you can force a page break to occur before that element when printing your website, like so:使用div上的page-break-before属性,您可以在打印网站时强制在该元素之前发生分页,如下所示:

.student {
    page-break-before: always;
}

This will not work on an empty div , but that does not apply to your case from the sound of it.这不适用于空的div ,但从它的声音来看,这不适用于您的情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM