Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Learn More

not centering data on printer

  • 2 trả lời
  • 1 gặp vấn đề này
  • 4 lượt xem
  • Trả lời mới nhất được viết bởi Col_Boogie

more options

see https://americasfreedompressalliance.us/Howard/Demo/hmorris/2013CalB.html When I print preview the file I lose data on the right and data not centered. Used @media print, options seemed to be ignored - can use view source all self contained. using relative width of media which seems to be ignored. Yes, Shrink to fit helps, but that leaves too much space on the bottom of page. Works with MS Edge.

see https://americasfreedompressalliance.us/Howard/Demo/hmorris/2013CalB.html When I print preview the file I lose data on the right and data not centered. Used @media print, options seemed to be ignored - can use view source all self contained. using relative width of media which seems to be ignored. Yes, Shrink to fit helps, but that leaves too much space on the bottom of page. Works with MS Edge.

Tất cả các câu trả lời (2)

more options

I'm assuming this is your website.

Firstly, in the print rules you have set your content width (.Main) to a fixed width of 7.5in. It's poor practice to set a fixed width when printing, since it limits how the browser is able to adapt your content to fit the page. It should be width: 100%; instead.

This issue is coupled with the fact that the print rules for the .Main element is not removing the padding from the left and right of the page content. This would be done by adding padding:0; to the rule.

Essentially, because you have set the content to be 7.5 inches wide with 1 inch on either side, the document is 9.5 inches wide. Setting the printing scale to 100% means that trying to print on paper less than 9.5 inches wide is going to cause content on the right side to overflow off of the page.

The reason you are seeing a lot of whitespace on the Fit to page option is because Firefox is still trying to print the 1 inch padding on either side of the content. So you are printing an extra 1 inch of space on either side, plus whatever margins your printer has set.

So your CSS rules for the print media query needs to be:

.Main {
    width: 100%;
    padding: 0;
}

Hope this helps.

Được chỉnh sửa bởi Wesley Branton vào

more options

I changed it to margin:.5in and it works the one inch on either side was for screen only, not print style for screen should not apply to print