How to make page border in print CSS for every single page

后端 未结 3 1467
臣服心动
臣服心动 2020-12-11 16:18

I have a long HTML to print. Page is ready for printing but I need to border every single page. I added body { border:2px #666 solid; padding:5px; } in CSS cod

3条回答
  •  离开以前
    2020-12-11 16:40

    By default, the border renders outside of the area of the element.

    Try adding this to the print CSS:

    body { box-sizing: border-box; border: 10px solid black; }
    

    Hope this helps!

    Edit: you can also try making the border bigger, and adding temporarily !important to the box-sizing and border CSS. That sometimes helps me find the source of the trouble.

提交回复
热议问题