Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13
  1. #1
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Use media="screen, projection"

    This is an informational thread, which I was inspired to post because I've noticed Eric Meyer does the same thing as I do with stylesheet media:
    Code:
    media="screen,projection"
    I don't know if his reasons are the same as mine, but here are mine, in case this information is useful to anyone else:

    Never use media="all" - because it's evil - how can you possibly know that your CSS is universally suitable? Do you have a "handheld" media device to test on? How about "aural" or "braille"?

    So don't apply CSS to a media for which you don't have a test device - in most cases that means "screen" and possibly "print".

    So about "projection"? Well - Opera 7 in fullscreen mode uses "projection" media CSS, not "screen" - the point of that is so that the browser can be used to do slideshows and other kinds of presentation - the sort of thing one might use PowerPoint for - except of course that Opera is free, can be easily carried around on a USB drive or ZIP disk, and lets you write your presentations in HTML and CSS - no proprietary data formats or having to buy MS Office.

    But from the point of view of most websites, that's a gotcha. What if someone's visiting your website in Opera in fullscreen mode, just because they want to - if all your CSS is "screen" then the site will be plain - no styling at all.

    Hence the dual-media declaration: meda="screen,projection"
    Last edited by brothercake; 02-24-2004 at 07:05 PM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #2
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    Nice! ... As soon as my server comes back online ( if ) I'll have to change that..
    Omnis mico antequam dominus Spookster!

  • #3
    Senior Coder
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    1,963
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That's a great tip
    Although you haven't actually mentioned where the "media" attribute is used, which may confuse people new to code.
    Code:
    <link rel="stylesheet" type="text/css" href="style.css" media="screen,projection" />

    I take no responsibility for the above nonsense.


    Left Justified

  • #4
    Regular Coder
    Join Date
    Aug 2003
    Posts
    565
    Thanks
    0
    Thanked 0 Times in 0 Posts
    great tip!


  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    The Netherlands, Baarn, Ut.
    Posts
    4,253
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Good to know!

    Brothercake,

    useful information indeed; I'm also curious about what Eric Meyer's opinion on this is. Have you contacted him about it?
    Regards,
    Ronald.
    ronaldvanderwijden.com

  • #6
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,266
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Ok, I been livin in a cave for the past 10 years Who's eric meyer and what's this media="screen" thing actually do? Someone bring me into modern ages

  • #7
    Senior Coder
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    1,963
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Eric Meyer is Netscape DevEdge's CSS guru. His demonstration of (what was then) advanced CSS techniques at css edge are very cool .
    He's part of that whole "upper echalon" of CSS/standards super freaks.

    media="screen" dellivers the file which is linked only to a UA which is displaying on a screen. Braille readers for example would obviously not be fed this stylesheet...

    I take no responsibility for the above nonsense.


    Left Justified

  • #8
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by mindlessLemming
    Braille readers for example would obviously not be fed this stylesheet...
    Except that they would, because braille readers are linked to screen readers, and screenreaders read the screen ... but in theory that's true ...

    Thanks for mentioning what I missed You can also use media with a <style> element:
    Code:
    <style type="text/css" media="screen,projection">
    Or using @media inside a stylesheet - but this won't work in mac/ie5:
    Code:
    @media screen,projection {   }
    Last edited by brothercake; 02-26-2004 at 04:08 AM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #9
    Senior Coder
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    1,963
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by brothercake
    Except that they would, because braille readers are linked to screen readers, and screenreaders read the screen ... but in theory that's true ...
    Ok then, so what UA's don't use media="screen,projection"
    And while you're at it, do any UA's exclude "screen,projection" when a page is printed? Or do you have to overwrite all other declarations?
    (Assuming that a second stylesheet w/ media="print" has been linked)
    Thanks for the tips
    Andrew

    I take no responsibility for the above nonsense.


    Left Justified

  • #10
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    When you print, a "screen,projection" stylesheet won't be used at all - it will be ignored. You don't have to override its values from print CSS, you're starting again with an unstyled page.

    The only screen-based CSS browser I know of that doesn't work with screen-media is Netscape 4 - ns4 doesn't read any styles if the <link> element has a media attribute, but that's useful in itself.

    There are extra gotchas as well - some handheld devices read "screen" media CSS, even though that's clearly in violation of the specs. But some manufacturers think that if they don't do that, pages viewed from their PDAs might not be styled at all - which is true, and that would be probably be better for users than a screen-styled page. But there you go - vendors are only concerned with their own, narrow interests.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #11
    Senior Coder
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    1,963
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for clearing that up.
    Does anyone know if print units can be used in print CSS? (inches, cm, etc..)

    I take no responsibility for the above nonsense.


    Left Justified

  • #12
    Regular Coder
    Join Date
    Jun 2002
    Location
    Iowa / Notre Dame
    Posts
    538
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm not sure about the print units, but with a print stylesheet percentages have a lot more power. Instead of not knowing how big 90% is on a certain user's screen, you will always know that 90% is 90% of the paper the user is printing on (not factoring in margins and such, 90% of the standard paper would be 7.65 inches). That's usually how I deal with print and it doesn't seem to have failed me yet.
    My Site {Mike's Adventures}

    Yikes, forums are almost too much fun.

  • #13
    me'
    me' is offline
    Senior Coder
    Join Date
    Nov 2002
    Location
    Warwickshire, England
    Posts
    1,229
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by mindlessLemming
    Does anyone know if print units can be used in print CSS? (inches, cm, etc..)
    What else would they be included in CSS for? I believe print is the only good application of those types of measurements. I'm possibly wrong, though.
    David House - Perfect is achieved, not when there is nothing left to add, but when there is nothing left to take away. (Antoine de St. Exupery).
    W3Schools | XHTML Validator | CSS Validator | Colours | Typography | HTML&CSS FAQ | Go get Mozilla Now | I blog!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •