开发者

Centering elements when printing

I have a webpage where all the content is centered using a wrapper div. It displays fine, but when it print the entire webpage becomes left-aligned. I want the page to be centered on the sheet.

Basically what I have is:

<div id="wrapper">
   Contents
</div>

The contents div is centered using CSS in the following way:

body{ width: 100%; margin: 0; }
#wrapper {width: 60%; margin-left: auto; margin-right: auto; }

Is there a way to make开发者_如何学运维 the page centered when printing?


Yes, the same way. Just make sure that 'print' is included in the media types specified for the stylesheet.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜