brimac <bri...@bcs.org> added the comment:
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 <rep...@bugs.python.org>
>
> Ezio Melotti <ezio.melo...@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 <rep...@bugs.python.org>
> <http://bugs.python.org/issue6670>
> _______________________________________
>
----------
Added file: http://bugs.python.org/file15069/unnamed
_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue6670>
_______________________________________
Hi Ezio<br><br>Many thanks for all your effort with this problem.<br>Thanks
also for the full explanation and link.<br>I'm not sure what happens now.
Will somebody fix it?<br>I think it's important for Python's image
because<br>
it might be the first page a new user tries to
print.<br><br>brimac<br><br><br><div class="gmail_quote">2009/10/6 Ezio Melotti
<span dir="ltr"><<a
href="mailto:rep...@bugs.python.org">rep...@bugs.python.org</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204,
204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im"><br>
Ezio Melotti <<a
href="mailto:ezio.melo...@gmail.com">ezio.melo...@gmail.com</a>> added the
comment:<br>
<br>
</div>To fix this problem is enough to add an !important to the margin: 0;<br>
rule in the @media print {} at the end of basic.css (line 408).<br>
<br>
I'll try to explain why the !important is necessary.<br>
In default.css @import url("basic.css"); (correctly) appears at
the<br>
beginning, and imports the rules from basic.css, including the @media<br>
print {}. A few lines later, in default.css, there's the rule<br>
div.bodywrapper { margin: 0 0 0 230px; }, and with no @media specified<br>
it defaults on 'all'.<br>
<br>
In default.css we then end up with something equivalent to:<br>
<br>
/* This is defined in basic.css and imported<br>
 at the beginning of default.css */<br>
@media print {<br>
  /* some rules omitted for clarity */<br>
  div.bodywrapper { margin: 0; }<br>
}<br>
<br>
/* This is defined later in default.css */<br>
@media all { /* This is implicit */<br>
  div.bodywrapper { margin: 0 0 0 230px; }<br>
}<br>
<br>
When the file is printed both the rules are applied, because 'all'
also<br>
includes 'print'.<br>
Since both the media have the same priority (i.e. the specific @media<br>
print does NOT have higher priority than the implicit @media all) and<br>
both the rules have the same priority too, the latter wins.<br>
The !important is then needed to raise the priority of the first rule.<br>
<br>
Note that adding the !important is not a really good solution IMHO: the<br>
problem could appear again if other rules with the same priority of the<br>
ones in @media print {} are specified elsewhere.<br>
A good solution would be to move the print rules after the normal ones,<br>
so in case the print media is used these rules will have higher priority.<br>
The @import can only appear at the beginning of a file so the two<br>
possible solutions are:<br>
<br>
1) put the rules with media all in, for example, all.css and the ones<br>
with media print in print.css and then, in default.css, write only:<br>
@import url('all.css');<br>
@import url('print.css') print;<br>
<br>
2) like 1) but importing the print.css separately using <link> in the<br>
html pages:<br>
<link href="default.css" type="text/css"
rel="stylesheet"><br>
<link href="print.css" type="text/css"
rel="stylesheet" media="print"><br>
<br>
A third solution might be to specify the media of the normal rules to<br>
'screen', but some rules are probably common to both the media.<br>
<br>
More information here: <a href="http://www.w3.org/TR/CSS2/cascade.html"
target="_blank">http://www.w3.org/TR/CSS2/cascade.html</a><br>
<br>
----------<br>
<div><div></div><div class="h5"><br>
_______________________________________<br>
Python tracker <<a
href="mailto:rep...@bugs.python.org">rep...@bugs.python.org</a>><br>
<<a href="http://bugs.python.org/issue6670"
target="_blank">http://bugs.python.org/issue6670</a>><br>
_______________________________________<br>
</div></div></blockquote></div><br>
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com