- From: Tantek Celik <tantek@cs.stanford.edu>
- Date: Tue, 12 Jan 1999 17:47:09 -0800
- To: MWhisman@aol.com, ron@persimmon.com, www-style@w3.org
> From: MWhisman@aol.com > Date: Tue, 12 Jan 1999 16:24:24 EST > >In a message dated 1/12/99 2:30:53 PM Central Standard Time, ron@persimmon.com >writes: > ><< My apologies if this is not appropriate for the group, but I have a > question about the relationship between CSS and the browser's print > functionality. It appears that the current browsers are unable to print > HTML documents that are formatted with CSS rules. Is this a browser > limitation that we can expect to improve over time, or is it a more > fundamental problem with the nature of CSS? Has W3C published anything > related to print capabilities? > >> Internet Explorer 4.5 Macintosh Edition has greatly improved printing support. You should be able to print what you see on the screen - assuming that is what you want. With all due respect to web authors, most web pages were not designed/authored for the print medium. Due to that reality, MacIE4.5 does a couple of automatic things to make printing "work". 1. Shrink to fit. The dimensions of the page are adjusted to make slightly too wide tables etc. fit horizontally on a single page. This solves the "right side of the table get clipped out" problem that you might have been seeing when printing. This option can be turned off in the "Print Preview" window before printing if you really want to. 2. (Don't) print backgrounds. By default, MacIE4.5 does NOT print background colors or images, and, has logic to take white (light-colored) text on black (dark-colored) backgrounds and "invert" it and print it as black (dark-colored) text on a white background. Again, if you really want to spend lots of toner or ink cartridge, you can turn off this option and print backgrounds as they are on the screen. 3. Finally there is an option to NOT print images if you don't need them. Again, this is a toner/ink cartridge saver, and kind of acts like @media print { IMG { visiblity: hidden} }. By default images ARE printed however, so you have to explicitly choose for them not to be if you don't want them. Because of these features, we think MacIE4.5 has the best printing support of any shipping web browser, given the present state of web content out there. Check it out! Feel free to contradict me with counter-evidence! >I'm using MSIE4.01 on Win95 platform, printing to a PostScript Level >2-compatible laser printer. I've begun writing HTML4 docs with an externally >linked CSS2 stylesheet. I based the CSS file on the sample CSS file given in >the CSS2 recommendation [1], with a few additions and modifications to suit my >taste for the (first) site I'm developing. > >[1] <A HREF="http://www.w3.org/TR/REC-CSS2/sample.html">Appendix A: A sample >style sheet for HTML 4.0</A> http://www.w3.org/TR/REC-CSS2/sample.html > >My printouts of the web pages are just great, except that Hn headings seem to >have different (less) space above/below the headings than on-screen, and my >P.indent paragraphs do not print out with a first-line text-indent, unlike on- >screen. Thus the in-print paragraphs appear to run together. The ordinary P >paragraphs do have margin-top/bottom > 0. The P class="indent" paragraphs are >set with top/bottom margins of 0 (zero) so as to give a traditional paragraph >with a first-line indent. > >If anyone can answer this, I'd appreciate it. Perhaps my problem and Ron's >have to do with a browser's print capabilities. If you send me a URL (or source) to a sample HTML4 document that exhibits these problems, I'll forward it to the WinIE folks, and double check and see how it prints in MacIE. If you find any printing problems in MacIE4.5, please feel free to email me directly. >I would like to be able to set on-screen and in-print font-size independently, >but have not experimented nor read the CSS2 spec fully yet to see if I can set >font-size in @media print { } for instance. You don't even need CSS2 to do this - you can do it with only HTML4 and CSS1! In HTMl4, both the STYLE and LINK tags in HTML have an optional MEDIA attribute which can take various values such as "print" or "screen" or even "print, screen" (although you should probably use "all" instead) see http://www.w3.org/TR/REC-html40/present/styles.html#h-14.2.4 http://www.w3.org/TR/REC-html40/types.html#type-media-descriptors So, all you need is at least one *CSS1* style sheet per medium that you want to render on; one for print, and one for screen. Alternately, you could have one "common" (MEDIA="all") style sheet which contained all the common style rules that you want on all media, and then have specific style sheets (e.g. MEDIA="print") which have additional rules (e.g. BODY { font: 11pt/1.2 Times,serif } ) for the print medium or any other medium you have to do special styling for. > On some screens or some printers, >a visitor might want a smaller screen font size and larger print font size, or >vice versa. Visually impaired, including older, users, might want bigger >fonts; eagle-eyed folks might want tiny fonts. An excellent justification for alternate style sheets. Even alternate media dependent style sheets for that matter. > One may only (at least for >MSIE) set an overall, single default font-size in the internet options dialog. Interesting, are you suggesting that we need not only user style sheets but user style sheets per medium that the browser supports? Of course if you don't mind depending on CSS2 you can use the @import url("print.css") print; technique or the @media print { } technique inside your user style sheet to achieve this effect. Tantek Çelik tantekc@microsoft.com Internet Explorer for Macintosh http://www.microsoft.com/mac/ >@media print { > @page { margin: 10%; } > H1, H2, H3, > H4, H5, H6 { page-break-after: avoid; page-break-inside: avoid; } > BLOCKQUOTE, > PRE { page-break-inside: avoid; } > UL, OL, DL { page-break-before: avoid; } >} Again, I personally think that rather than @media, that using the MEDIA="print" attribute on the appropriate LINK or STYLE tag in HTML4 is probably a better bet than depending on CSS2, at least given today's UAs.
Received on Tuesday, 12 January 1999 20:39:16 UTC