Why is it so hard to print a web page properly? [closed]
I printed a page from a bank we开发者_C百科b site. Aside from the page with my data, I got five other pages with just a logo, just a header, just a footer, etc. It's sort of a joke in my household that you can't print a web page without getting a useless wasted page too.
So, why is it so hard? Are we blaming the web page designers, the browsers, or who? I would have thought this would be a mature technology by now and suffer from these idiotic little foibles.
I especially don't understand why printing from a "print preview" gives you something different from what you preview.
If you're looking for the programming perspective on this - it's hard, because screen size and resolution is different from the size and resolution of the printed page. Therefore most pages will not automatically print well - it's up to the web designer add CSS that's specific to printed output:
<link rel="stylesheet" type="text/css" media="print" href="print-only.css" />
Most web designers are too lazy to do this unless there's a specific reason to print their page, so most pages don't print well.
At best, web pages are designed to flow and scroll on various screen sizes. At worst, they only work on a single size screen. Printed pages obviously have pagination, not scrolling, and they use a fixed size.
As Leniel says, CSS media types provide a suitable mechanism to provide different styles on a printed page, but from my experience not many sites use it.
From here:
Two of the most common problems with printing occur when positioning other than static is used (e.g. position: absolute) or when there are floats.
Developers have the choice of making a special version of a given page so that it can be printed the right way. This can be achieved using the media type "print" with CSS.
See these pages for further reference:
Print Stylesheets
CSS Media Types
精彩评论