W3C home > Mailing lists > Public > www-style@w3.org > August 2011

Re: background-print

From: Håkon Wium Lie <howcome@opera.com>
Date: Fri, 12 Aug 2011 15:35:40 +0200
Message-ID: <20037.11308.155450.640768@gargle.gargle.HOWL>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: www-style list <www-style@w3.org>
Also sprach Tab Atkins Jr.:

 > > > http://lists.w3.org/Archives/Public/www-style/2011Jul/0341.html

 > > What's wrong with this?:
 > >
 > > @media print {
 > >  * { background: none }
 > > }
 > I'm not sure I understand.  Are you suggesting that the UA put that in
 > its UA stylesheet, such that it can be overridden by the author as
 > desired?

The start of the thread, in the above URL reads:

  Want authors to be able to specify whether backgrounds should be printed

And this code turns off printing of backgrounds:

   @media print {
     * { background: none }

So it seems like a simple solution to the problem statement. 
It can be used in user/browser/author style sheets.

 > If so, then the suggestion has several problems, unfortunately.  For
 > one, UAs do more than suppress backgrounds; they also adjust text
 > colors to ensure that there is still adequate contrast.

Now you're extenting the scope of the problem. But this can also be expressed:

   @media print {
     * { color: black; background: white }

Opera provides high-contrast style sheets like these in View->Style->

 > For two, that
 > rule would get overridden by a background set in media=all, which is
 > the default for stylesheets that don't specify a @media.  

No, it's the weight, specificity and order of appearance that
determine winning declarations -- media type does not matter.

 > It's the color-adjustment that really clinches the fact that we can't
 > solve this solely by fiddling with 'background'.  This really is a
 > separate control with unique behavior, and has to be addressed with
 > its own property (or some other entity, like an @-rule).  I still
 > suggest:
 > printer-safe-colors: _prefer_ | avoid;

If we just need a document-wide switch to turn on magic, the @page
context seems to be the right place:

  @page { 
    size: a4;
    print: magic; /* or something */



              Håkon Wium Lie                          CTO °þe®ª
howcome@opera.com                  http://people.opera.com/howcome
Received on Friday, 12 August 2011 13:36:24 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:03 UTC