简体   繁体   English

如何在打印时将页面边框赋予html页面?

[英]How can I give page border to html page while printing?

Actually I have border in html page. 其实我在html页面有边框。 while printing, the content is coming in two pages and bottom-border for first page and top-border for second page does not occur.so how can I give page border for each page while printing.I have used @media print and wrote css inside that. 在打印时,内容分为两页,第一页的下边框和第二页的上边框不会出现。如何在打印时为每页提供页面边框。我使用了@media print并编写了css在里面。 Is there any other solution such that I should get boder on all sides for each page when printing the page ? 是否还有其他解决方案,以便在打印页面时,我应该在每个页面的各个方面都使用?

I've made a sample page here which will generate a border for every page. 我在这里制作了一个示例页面,它将为每个页面生成一个边框。 while printing the page. 在打印页面时。 see DEMO . DEMO

HTML Code HTML代码

<section id='page1'>
     <div class='box'></div>
</section>
<section id='page2'>
     <div class='box'></div>
</section>
<section id='page3'>
     <div class='box'></div>
</section>
<section id='page4'>
     <div class='box'></div>
</section>

CSS Code CSS代码

@media screen, print
{
 .box{
  border:1pt solid black;
  border-radius:15px;
  position:absolute;
  top:0;
  width:28.2cm;
  height:19.3cm;
  }
section{position:relative;}
}

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

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