Forum Moderators: not2easy
I'm using something like:
@media print{
body{ background-color:#FFFFFF; background- image:none; color:#000000 }
#ad{ display:none;}
#leftbar{ display:none;}
#contentarea{ width:100%;}
}
This dosen't seem to work to hide templates. Are there any restrictions to the method that I'm using? Can templates be hid dynamically in any other way?
I'm not sure what you mean by a 'template'. Presumably you are using some kind of web design software?
Anyway, what you have there looks correct to me.
If the #ad and #leftbar are not disappearing on your print out then you may have the names wrong. Check them and if you still have problems post a small extract of HTML that shows the problem.
(but don't post a link to an example site or anything because its against the Terms of Service).
Incidentally, another way to handle print stylesheets is to have an entirely different stylesheet file and then link to it like this in <head>..
<link rel="stylesheet" media="print" href="print.css" type="text/css"> ..that way you can keep the size of your main stylesheet down and the browser should only have to load the print stylesheet when you actually want to print.
I tried not displaying the table itself but its not working.
Hmm... if the background is still there when you hide the table then maybe the tables background was transparent and its the background from something underneath that is showing through?