Html – Print from Chrome is not centered

cssgoogle-chromehtmlprinting

I create simple page which I want to print from a browser.
I put all whistles I was able to find to center my title and picture.

<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>

The page looks fine and centered in all browsers.
The page is printed fine (centered) in IE and Firefox, but in Chrome the whole body box is left-justified and much smaller than page width.
Is there any whistels that would help to print centered title/image from Chrome?


Problem solved.
The problem was in Chrome itself. To be more exact, in Print Preview which uses Chrome PDF Writer plug-in. Looks like the Chrome PDF Writer does not recognize page size and does not have any Page Setup settings. I disabled Chrome's Print Preview, installed Adobe's PDF Printer, and everything prints OK with my original code fragment.

Best Answer

try this

<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>

either

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

or

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

worked for me in chrome, printed to a pdf