Page 1 of 1

Media-specific stylesheets

Posted: Tue Nov 25, 2003 4:19 pm
by uberpolak
I'm trying to get a separate stylesheet for printing, but the print preview is making it look like no sheet is loaded at all.

Here is my style markup in the .htm file:

Code: Select all

<link rel="stylesheet" type="text/css" href="styles/pf.css" media="print" title="Printer Friendly" />
<link rel="stylesheet" type="text/css" href="styles/green.css" media="screen" title="Standard Style" />
<link rel="alternate stylesheet" type="text/css" href="styles/greenl.css" media="screen" title="Large Print" />
<link rel="alternate stylesheet" type="text/css" href="styles/bw.css" media="screen" title="Black and White" />
<link rel="alternate stylesheet" type="text/css" href="styles/bwl.css" media="screen" title="Large Print Black and White" />
Yes, I have to have all those style options, the client requires all those versions of each page, unfortunately. Can anyone see what's wrong with this? I can't figure it out. The file pf.css itself is fine, when I run it as the screen stylesheet it gets picked up and works just the way I want it to.

Thanks.

Posted: Tue Nov 25, 2003 4:36 pm
by microthick
I am unable to find any errors.

Do you have a test URL I can check to see if I have the same problem?

Posted: Tue Nov 25, 2003 4:53 pm
by uberpolak
Sorry, the site is still just being developed locally, it's not online yet. Thanks for offering, though.

Posted: Tue Nov 25, 2003 6:23 pm
by uberpolak
Update:

I've (sort of) solved the problem, and in case anyone wanted to know how to do that, I'll post it.

It turned out the problem was that alternate stylesheets make Internet Explorer (even more) moronic. It messed up the print stylesheet whenever more than one stylesheet had been activated, not necessarily at the same time, it started ignoring the print sheet. I still don't know why.

I worked around this by using PHP Session variables to have only one stylesheet loaded at a time, based on a select box the user always has access to. They can still change it, but now they have to reload the page every time they want to change styles. The upside is, the damn thing works.