gpt4 book ai didi

javascript - 打印页面 : Content only on 2nd Page?

转载 作者:行者123 更新时间:2023-11-28 10:11:18 24 4
gpt4 key购买 nike

我需要打印 网页内容 (HTML/CSS)。我需要做的一件事是打印一些东西(页码、文档标题)在除第一页以外的每一页上

有没有办法让 div(或其他元素)只出现在页面 >=2 上?

我没有任何手动分页符

可以使用 jQuery

最佳答案

带有 :first 的 CSS @page 指令将 CSS 应用于 html 打印的第一页

我举了一个#header#footer 的例子,可能对你有帮助

@media print {
@page {
/* Styles for every page other than first page */
#header {
position: fixed;
display: block;
top: 0;
}
#footer {
position: fixed;
display: block;
bottom: 0;
}
}
@page :first {
/* override the styles for the first page */
#header {
display: none;
}
#footer {
display: none;
}
}
}

关于javascript - 打印页面 : Content only on 2nd Page?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24370486/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com