问题描述
我有一个带有 2 个可打印页面的 html 页面.我为每个页面创建了一个媒体打印样式边框,但我的代码只为第一页添加了一个边框.
I have an html page with 2 printable pages. I created a media print style border for each page but my code adds a border for the first page only.
我需要添加什么才能在每个页面上显示边框?
What do I need to add to show the border on every page?
请在下面找到我的印刷媒体 CSS 并查看我的屏幕截图;
Please find my print media CSS below and take a look at my screenshot;
@page {
size: A4; /* auto is the initial value */
margin: 1.54cm 1cm 1.54cm 1cm;
marks: crop cross;
}
html, body {
-webkit-print-color-adjust: exact;
margin:0;
padding:0;
height:100%;
min-height: 100%;
border: 2px solid #cc0000!IMPORTANT;
}
.contract {
min-height:100%;
position:relative;
height: 100%;
box-decoration-break: clone;
}
h2, h3 {
page-break-after: avoid;
}
有BUG的截图:http://scr.hu/0fbv/5u4qh
推荐答案
我遇到了类似的问题.这是我如何做到的:#body {边框样式:实心;边框颜色:红色;}
I was having a similar problem. Here is how I did it:#body { border-style: solid; border-color: red;}
如果这不起作用,请尝试将边框颜色直接放入媒体中.记得先添加border-style:solid;
,通过.
If this doesn't work, try putting the border color directly into the media. Remember to add border-style: solid;
first, through.
这篇关于所有页面的正文边框 - CSS 印刷媒体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!