Print.css not being picked up


#1

I’m working on a new app and i can’t get print.css to work properly. I
can’t work out why. I’ve tried referencing it with the rails
stylesheet_link_tag helper and by hard-coding the link. Neither work -
when i go to print-preview (in firefox) it’s not using the right
styling.

The file, print.css, is in public/stylesheets. I’ve tried this:

<%= stylesheet_link_tag “print”, :media => “print” %>

which generates:

and i’ve tried this:

which of course just stays as it is. Neither work. is there something
special i have to do with print stylesheets in rails?

thanks
max


#2

I have
<%= stylesheet_link_tag ‘print’, :media => :print %>
which seems to generate the same link as you have and it works fine in
FF
3.0.10

Have you tried temporarily removing your standard stylesheet and
replacing
it with a renamed version of print.css to make sure it is not a problem
with
the contents?

Colin

2009/5/20 Max W. removed_email_address@domain.invalid


#3

Thanks, colin, i figured it out. The problem was that the main
stylesheet, style.css was also being used for printing, so i needed to
change the link for the main stylesheet to have media=“screen, print”.
So, it was nothing to do with the link to print.css at all.

So, now my links look like this:

<%= stylesheet_link_tag "style", "incomplete", :media => "screen, 

print" %>
<%= stylesheet_link_tag “print”, :media => “print” %>

and it’s all good.

cheers
max