如何格式化8.5x11英寸打印页面的CSS [英] How to format CSS for 8.5x11 inch printed pages

查看:56
本文介绍了如何格式化8.5x11英寸打印页面的CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻求帮助,以设置适合信纸边框的初始DIV.我将循环搜索动态页面内容,每个页面以`page-break-after结尾.总是;.

I am looking for help setting up the initial DIV that will fit within the borders of the letter paper. I'll loop for dynamic page content ending each page with `page-break-after; always;.

我一直在使用试错法,现在用完纸就可以尝试.

I've been using the trial and error approach and have now run out of paper to trial with.

如何在位置与纸张边距相关的位置设置div容器?

How do you setup the div container where positions relate to the paper margins?

谢谢!

推荐答案

使用CSS重置模板后,在打印选项中关闭缩小到页面"后,我就能制作出7的DIV(约670像素))宽9.5高(约900像素).我可以在此框内定位.

After using a CSS reset template, and with "shrink to page" turned off in print options I am able to make a DIV that is 7" (about 670px) wide and 9.5 (about 900px) high. I can position inside this box.

它在我连接的打印机之间可以正常翻译.如果我的计算正确,则打印DPI约为95ppi.

It translates fine between the printers I have connected. If my calculations are correct, the print DPI is about 95ppi.

#printPage
{
  margin: 0px;
  padding: 0px;
  width: 670px; /* width: 7in; */
  height: 900px; /* or height: 9.5in; */
  clear: both;
  background-color: gray;
  page-break-after: always;
}

然后像这样定位:

#cube
{ 
  position: relative;
  top: 1in;
  left: 1in;
  width: 1in;
  height: 1in;
  background-color: white;
}

这篇关于如何格式化8.5x11英寸打印页面的CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆