首页 文章

Chrome中的打印不会居中

提问于
浏览
5

我创建了一个简单的页面,我想从浏览器打印 . 我把我能找到的所有口哨放在我的 Headers 和图片的中心位置 .

<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打印中心 Headers /图像?


问题解决了 .
问题出在Chrome本身 . 更确切地说,在使用Chrome PDF Writer插件的打印预览中 . 看起来Chrome PDF Writer无法识别页面大小,也没有任何页面设置设置 . 我禁用了Chrome 's Print Preview, installed Adobe'的PDF打印机,所有内容都打印好了原始代码片段 .

1 回答

  • 3

    试试这个

    <body>
        <div align="center" style="text-align:center;">
            <div style="font-size:48pt">
                Pretty Long-Long-Long Title
            </div>
            <img src="content/images/sample.jpg" style="width:80%"/>
        </div>
    </body>
    

    <div align="center" style="text-align:center;">
    

    要么

    <div style="text-align:center;margin:0 auto;">
    

    我用chrome工作,打印成pdf

相关问题