html - 选择@page的特定页面

标签 html css

所以我正在制作一个带有 html 和 css 的文档用于打印,当我尝试选择整个文档的特定页面时:

@page :nth(5) {
background-color: aqua;
}

它不选择页面(在这个例子中是背景颜色)

我想实现的是选择整个文档的特定页面。

最佳答案

请引用documentation (或对于规范,here)。关于 @page 规则的使用:

You can only change the margins, orphans, widows, and page breaks of the document. Attempts to change any other CSS properties will be ignored.

如您所见,更改 background-color 属性将被忽略。

关于html - 选择@page的特定页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45980294/

相关文章:

html - 我在 ul、li 元素中嵌套 CSS/HTML 复选框时遇到问题

HTML5 属性值规范化

html - 为什么 anchor 按钮超出包装边界?

javascript - jQuery图片悬停和点击冲突

javascript - 文本动态更新后Cufon不显示

html - 如何通过groovy脚本将HTML内容解析为Jenkins参数?

HTML 表格标题和表格的总高度

html - 强制 div 并排显示并隐藏任何溢出

javascript - 单击某些文本时在 html 中添加 required

html - 左侧带有文本的进度条 - bootstrap