div布局问题,同时打印pdf
听起来你试图让一个棘手的注脚。如果您知道蓝色部分的高度,则可以使用此CSS-Tricks post中描述的粘性页脚方法。
下面是基于该方法的例子...
html, body {
height: 100%;
}
.top {
min-height: 100%;
/* equal to bottom height */
margin-bottom: -142px;
}
.top:after {
content: "";
display: block;
}
.bottom, .top:after {
/* .push must be the same height as bottom */
\t height: 142px;
}
.bottom {
background: #ccc;
}
<div class="top">
<h1>Top</h1>
</div>
<div class="bottom">
<h1>Bottom</h1>
</footer>
谢谢你的答复,但我不想要一个粘性的页脚,实际上我打印PDF,但是当布局超过了它的页面高度,其结构中断。 – user1581108
结构如何中断?你是否试图找到一种方法在你的html中插入分页符? – shanzilla
如果页面高度较短,我想分隔蓝色部分。实际上红色和蓝色部分是在一个div内进行测试。我用这个css .page-break {display:block;宽度:100%; float:left} @media print { .page-break,.page-break div \t {display:block; page-break-before:always;宽度:100%;向左飘浮; } \t } – user1581108
建议你修改你的问题 - 我想你是例如寻找粘页脚http://*.com/questions/21805590/css-sticky-footer –