I'm working on a site where the content of each page is between these 2 tags:
<div id="Content" style="position:absolute; left:210; top:89; width:503px; height:301px; z-index:3">
yada yada
</div>
The content of each page that I would like to be able to print is labeled "Content" in each page. Is there a way that I can use the @media print css option to only print what's in that div tag?
Thanks in advance.
dkozariYep.
<style type="text/css" media="print">
<!--
@import "print.css";
-->
</style>
In print.css:
div { display: none; }
div#content { display: block; }
Give that a whirl. You could also try setting the display properties of all the IDs to none individually, except for #content and any parent DIVs that may contain it. If more than what you want still shows up, just keep setting the DIVs display properties to none until only #content shows up.I can see where you're going with that. However I don't want anything except what is in that tag to print. Not the background image, not any tables, not any text, nothing. Is there a way to do that easily?
dkozarihow about modifying the code above?
div, table, anything else you don't want printed, {...}You mean that you want the browser to print the line of code "<div id="Content" style="position:absolute; left:210; top:89; width:503px; height:301px; z-index:3">"?
I guess I don't know exactly what you want to print if you don't want to print text, background images or tables. What else is there to print besides embedded images?You had the right idea. I got the code working. Thanks a lot. Take care of yourself.
dkozari
<div id="Content" style="position:absolute; left:210; top:89; width:503px; height:301px; z-index:3">
yada yada
</div>
The content of each page that I would like to be able to print is labeled "Content" in each page. Is there a way that I can use the @media print css option to only print what's in that div tag?
Thanks in advance.
dkozariYep.
<style type="text/css" media="print">
<!--
@import "print.css";
-->
</style>
In print.css:
div { display: none; }
div#content { display: block; }
Give that a whirl. You could also try setting the display properties of all the IDs to none individually, except for #content and any parent DIVs that may contain it. If more than what you want still shows up, just keep setting the DIVs display properties to none until only #content shows up.I can see where you're going with that. However I don't want anything except what is in that tag to print. Not the background image, not any tables, not any text, nothing. Is there a way to do that easily?
dkozarihow about modifying the code above?
div, table, anything else you don't want printed, {...}You mean that you want the browser to print the line of code "<div id="Content" style="position:absolute; left:210; top:89; width:503px; height:301px; z-index:3">"?
I guess I don't know exactly what you want to print if you don't want to print text, background images or tables. What else is there to print besides embedded images?You had the right idea. I got the code working. Thanks a lot. Take care of yourself.
dkozari