This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author brimac
Recipients brimac, ezio.melotti, georg.brandl, jnoller
Date 2009-10-07.13:11:43
SpamBayes Score 2.3892166e-11
Marked as misclassified No
Message-id <9bd6f93d0910070611x70eaac7dsd2b167769fee3f4a@mail.gmail.com>
In-reply-to <1254842417.98.0.960293600586.issue6670@psf.upfronthosting.co.za>
Content
Hi Ezio

Many thanks for all your effort with this problem.
Thanks also for the full explanation and link.
I'm not sure what happens now. Will somebody fix it?
I think it's important for Python's image because
it might be the first page a new user tries to print.

brimac

2009/10/6 Ezio Melotti <report@bugs.python.org>

>
> Ezio Melotti <ezio.melotti@gmail.com> added the comment:
>
> To fix this problem is enough to add an !important to the margin: 0;
> rule in the @media print {} at the end of basic.css (line 408).
>
> I'll try to explain why the !important is necessary.
> In default.css @import url("basic.css"); (correctly) appears at the
> beginning, and imports the rules from basic.css, including the @media
> print {}. A few lines later, in default.css, there's the rule
> div.bodywrapper { margin: 0 0 0 230px; }, and with no @media specified
> it defaults on 'all'.
>
> In default.css we then end up with something equivalent to:
>
> /* This is defined in basic.css and imported
>   at the beginning of default.css */
> @media print {
>    /* some rules omitted for clarity */
>    div.bodywrapper { margin: 0; }
> }
>
> /* This is defined later in default.css */
> @media all { /* This is implicit */
>    div.bodywrapper { margin: 0 0 0 230px; }
> }
>
> When the file is printed both the rules are applied, because 'all' also
> includes 'print'.
> Since both the media have the same priority (i.e. the specific @media
> print does NOT have higher priority than the implicit @media all) and
> both the rules have the same priority too, the latter wins.
> The !important is then needed to raise the priority of the first rule.
>
> Note that adding the !important is not a really good solution IMHO: the
> problem could appear again if other rules with the same priority of the
> ones in @media print {} are specified elsewhere.
> A good solution would be to move the print rules after the normal ones,
> so in case the print media is used these rules will have higher priority.
> The @import can only appear at the beginning of a file so the two
> possible solutions are:
>
> 1) put the rules with media all in, for example, all.css and the ones
> with media print in print.css and then, in default.css, write only:
> @import url('all.css');
> @import url('print.css') print;
>
> 2) like 1) but importing the print.css separately using <link> in the
> html pages:
> <link href="default.css" type="text/css" rel="stylesheet">
> <link href="print.css" type="text/css" rel="stylesheet" media="print">
>
> A third solution might be to specify the media of the normal rules to
> 'screen', but some rules are probably common to both the media.
>
> More information here: http://www.w3.org/TR/CSS2/cascade.html
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue6670>
> _______________________________________
>
Files
File name Uploaded
unnamed brimac, 2009-10-07.13:11:42
History
Date User Action Args
2009-10-07 13:11:45brimacsetrecipients: + brimac, georg.brandl, jnoller, ezio.melotti
2009-10-07 13:11:43brimaclinkissue6670 messages
2009-10-07 13:11:43brimaccreate