Forum Moderators: not2easy

Message Too Old, No Replies

Print media stylesheets

         

elijia3

7:37 pm on Feb 19, 2004 (gmt 0)

10+ Year Member



I have an issue where I'm trying to print out only the content of a page that was created from a template that contains uneditable sections.

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?

grahamstewart

12:15 pm on Feb 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld elijia3

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.

elijia3

2:48 pm on Feb 20, 2004 (gmt 0)

10+ Year Member



I'm using Deamweaver. A template is an uneditable section of your page that is common to a group of pages. When the template changes then all pages using it change as well.

grahamstewart

3:05 pm on Feb 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yeah thought it might be something like that.
Sorry for my ignorance, but I code everything by hand.

Have you checked that the ids of the items you are trying to control in css match the ids in the html e.g. is the div with the ad in it definitely id="ad"?

elijia3

3:17 pm on Feb 20, 2004 (gmt 0)

10+ Year Member



No. It appears that I didn't use ids for anything that I was trying to control. Thanks for the help. Id is there a way that I can rate you on this site?

elijia3

3:19 pm on Feb 20, 2004 (gmt 0)

10+ Year Member



One more thing. How do I get rid of a background image of a particular table? I tried not displaying the table itself but its not working. It works with every other table that dosen't have a background image.

grahamstewart

3:31 pm on Feb 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No rating system here, but thanks for the thought. *blush*

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?