Forum Moderators: phranque
<link rel='alternate' media='print' href='index.php?print=1>
so that anyone willing to print my index page will print a different layout of the page (remove banners, different header/footer, etc.)
Works great in Mozilla, IE, Netscape but NOT in Opera.
Is there any alternative I could use? @media?
So you should have:
<link rel="StyleSheet" href="style.css" type="text/css">
<link rel="StyleSheet" href="print.css" type="text/css" media="print">
Both are you MAIN css files for each type of media, so alternative css declarations are not needed. To view the print css file, you need to print the page or go to print preview.
echo "<link rel='alternate' media='print' href='index.php?print=1'>"; if ($print=="1") {
echo "<link rel='stylesheet' type='text/css' href='".$url_root."style_print.css'><style type='text/css'>@import url(".$url_root."style_print.css);</style>";}
else {echo "<link rel='stylesheet' type='text/css' href='".$url_root."style.css'><style type='text/css'>@import url(".$url_root."style.css);</style>";}
Encyclo, you wrote :
YES, it is a typo error, sorry!
The single quote because it is generated with the echo of PHP. I was not aware that it could make a difference? Are you sure about that?
Still, the thing is that this method works great in all browsers I have but not in Opera. I have done some search in Google but found nothing interesting. Is there any other script I could use?