Forum Moderators: not2easy

Message Too Old, No Replies

What is this media="screen,projection"?

         

PowerUp

3:21 pm on Mar 17, 2007 (gmt 0)

10+ Year Member



Hi I downloaded a free web template and I am planning to use it. I found this line between the head tags and I don't know what media="screen,projection" does. Can anyone enlighten me? Thanks.

<link rel="stylesheet" href="../mystyle.css" type="text/css" media="screen,projection" />

penders

3:30 pm on Mar 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



That is intended to deliver the stylesheet "mystyle.css" only when viewed on a computer screen, or by a projector (even bigger screen). This excludes printed media (ie. when you select File¦Print...), handheld devices and others.
[w3.org...]

What values are reliably supported by these devices I don't know?!

PowerUp

3:57 pm on Mar 17, 2007 (gmt 0)

10+ Year Member



Then, does this mean that I'll have to create a separate css file for the other types of devices?

If I remove the media="screen,projection", then by default, all media devices will share the same css file?

penders

3:22 pm on Mar 18, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



...a separate css file for the other types of devices?

Hhhhmmm, well maybe in a perfect world. But I guess this can depend on your target audience? And to some extend your design. Besides, how widely supported are the other media types? You may be able to cater for other devices by simply overriding a handful of styles in your default stylesheet, and this could even be done using @media rules in your default stylesheet, without even having a separate stylesheet? If you have a very flexible layout, do you even need a separate stylesheet for handheld devices, other than perhaps making the text smaller - but then that maybe handled by the 'small screen' device anyway?

For a

media="print"
stylesheet it is often useful to
display:none
the navigation sections of your page, as the content itself is usually what's wanted.

If I remove the media="screen,projection", then by default, all media devices will share the same css file?

Yes, I believe so, same as

media="all"
. Specify a
title
attribute and browsers that support switching stylesheets (eg. FF) will use the
title
to identify it.

More info on media types...
[w3.org...]

firstreflex

10:17 pm on Mar 20, 2007 (gmt 0)

10+ Year Member



Most people who use this don't like to use @import (FOUC), but they want to hide styles from NN4, a comma separated list of media types will do this, plus - prior to Opera 9, view > full screen in that browser and you'd get an unstyled page with only 'screen' declared.
2 birds with 1 stone.

penders

8:13 am on Mar 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



firstreflex: Interesting comments on NN4 and Opera.

Just to expand slightly on my first post...

...viewed on a computer screen, or by a projector (even bigger screen).

Having seen a recent review of projectors, it seems they currently share a very similar native resolution to your regular computer screen... so the image is only physically bigger.