How to set up media based style sheet

Giganews Newsgroups
Subject: How to set up media based style sheet
Posted by: (jrl@nospam.nospam)
Date: Thu, 15 Jan 2009

I am seeking general guidance on how to set up a master page that uses CSS
stylesheet according to media.
This technique allows the page to render differently on the screen, printer
or handheld.
I can explaine the method I am currently using,but there are problems with
it. If there is a better approach, I'm hoping to learn about it.

My current setup (using IIS 7, VS 2008 prof) is to have three files in a
directory called rosy, in the App_Themes directory (of a C# web site). The
files are screen.css, print.css, and handheld.css.

In the master page, I currently use this code

<head runat="server">
    <title>Untitled Page</title>
    <asp:ContentPlaceHolder id="head" runat="server">
    <link href="~/App_Themes/rosy/screen.css" media="screen"
rel="Stylesheet" />
    <link href="~/App_Themes/rosy/print.css" media="print" rel="Stylesheet"
    <link href="~/App_Themes/rosy/handheld.css" media="handheld"
rel="Stylesheet" />

Previously I was told I could try using

<pages styleSheetTheme="rosy">

in the site web.config. However, I wasn't sure if this would distinguish the
media types to be used.

Anyway, the problem is that the style sheets aren't loading in IIS. When a
user visits the site, there is no style being applied.

My question then is twofold:
1) how should I declare the stylesheets in a master page (any changes needed
to what I provided above)?
2) what might be preventing IIS from displaying the stylesheet I requested