Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > @media print

Reply
Thread Tools

@media print

 
 
Gregor Traven
Guest
Posts: n/a
 
      02-17-2005
Hi

When I use @media print in my css, the browser doesn't even consider the
values in this print section which were already defined furthermore in css.
For example: if I have h1 {font-size:25px} then h1 {font-size:10px} in
@media print section won't have any effect. Only the properties that haven't
been used in css work if I define them in @media print section of css. Why
is this so and can I do something to change it?

Thanks for answering

Gregor


 
Reply With Quote
 
 
 
 
Jukka K. Korpela
Guest
Posts: n/a
 
      02-17-2005
"Gregor Traven" <(E-Mail Removed)> wrote:

> When I use @media print in my css, the browser doesn't even consider
> the values in this print section which were already defined furthermore
> in css.


I don't quite follow; what does "already defined furthermore" mean?

> For example: if I have h1 {font-size:25px} then h1
> {font-size:10px} in @media print section won't have any effect.


It depends on the order. When rendering on print media, both rules are
considered. Since they are otherwise equal, the one that comes later wins,
by CSS rules. The @media print thing does not, somewhat unintuitively,
affect the specificity.

So if you have

h1 { font-size: 25px; }
@media print {
h1 { font-size: 10px } }

(which is poor practice in an author style sheet - px units are not
suitable for setting font size)

then the font size for h1 is 10px on print media, 25px on other media.
If you swap the order, then the size is 25px for all media.

If you wish to make the print-specific rule take priority independently of
the order, use can declare it important:

@media print {
h1 { font-size: 10px !important; } }

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html


 
Reply With Quote
 
 
 
 
Toby Inkster
Guest
Posts: n/a
 
      02-17-2005
Gregor Traven wrote:

> When I use @media print in my css, the browser doesn't even consider the
> values in this print section which were already defined furthermore in css.


URL?

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
Reply With Quote
 
Gregor Traven
Guest
Posts: n/a
 
      02-18-2005

"Jukka K. Korpela" <(E-Mail Removed)> wrote in message
news:Xns9600E86245B91jkorpelacstutfi@193.229.0.31. ..
> "Gregor Traven" <(E-Mail Removed)> wrote:
>
>> When I use @media print in my css, the browser doesn't even consider
>> the values in this print section which were already defined furthermore
>> in css.

>
> I don't quite follow; what does "already defined furthermore" mean?
>
>> For example: if I have h1 {font-size:25px} then h1
>> {font-size:10px} in @media print section won't have any effect.

>
> It depends on the order. When rendering on print media, both rules are
> considered. Since they are otherwise equal, the one that comes later wins,
> by CSS rules. The @media print thing does not, somewhat unintuitively,
> affect the specificity.
>
> So if you have
>
> h1 { font-size: 25px; }
> @media print {
> h1 { font-size: 10px } }
>
> (which is poor practice in an author style sheet - px units are not
> suitable for setting font size)
>
> then the font size for h1 is 10px on print media, 25px on other media.
> If you swap the order, then the size is 25px for all media.
>
> If you wish to make the print-specific rule take priority independently of
> the order, use can declare it important:
>
> @media print {
> h1 { font-size: 10px !important; } }
>
> --
> Yucca, http://www.cs.tut.fi/~jkorpela/
> Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
>
>


Thanks very much, what you wrote answered my question perfectly.

Gregor


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
print a vs print '%s' % a vs print '%f' a David Cournapeau Python 0 12-30-2008 03:19 AM
Problem - I want to print Current Output of Pdf file and should print once.I get print dialog box but it is not working keto Java 0 05-30-2007 11:27 AM
Can't print to print server =?Utf-8?B?cGVjaw==?= Wireless Networking 2 02-03-2005 02:41 PM
How to make use of "print to file" option by print =?Utf-8?B?enljZ3M=?= MCSE 1 01-04-2005 06:50 PM
Unlarging the print to print using PDF file to print Bun Mui Computer Support 3 09-13-2004 03:15 AM



Advertisments