【发布时间】:2011-09-12 18:04:51
【问题描述】:
我创建了我想从浏览器打印的简单页面。 我把我能找到的所有口哨放在我的标题和图片的中心。
<html>
<head>
<link rel="stylesheet" href="print.css" type="text/css" media="print" />
<!-- print.css is empty -->
</head>
<body style="text-align: center; margin: 0 auto;">
<div>
<div style="font-size:48pt">
Pretty Long-Long-Long Title
</div>
<img src="content/images/sample.jpg" style="width:80%"/>
</div>
</body>
</html>
页面在所有浏览器中看起来都很好并且居中。
该页面在 IE 和 Firefox 中打印良好(居中),但在 Chrome 中,整个正文框是左对齐的,并且比页面宽度小得多。
是否有任何提示可以帮助从 Chrome 打印居中的标题/图像?
问题解决了。
问题出在 Chrome 本身。更准确地说,在使用 Chrome PDF Writer 插件的 Print Preview 中。看起来 Chrome PDF Writer 无法识别页面大小并且没有任何页面设置设置。我禁用了 Chrome 的打印预览,安装了 Adobe 的 PDF 打印机,我的原始代码片段打印一切正常。
【问题讨论】:
标签: html css google-chrome printing