Click to See Complete Forum and Search --> : printing only what's inside one tag


dkozari
06-10-2003, 08:18 AM
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.

dkozari

toicontien
06-10-2003, 08:25 AM
Yep.


<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.

dkozari
06-10-2003, 08:33 AM
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?

dkozari

DaveSW
06-10-2003, 09:37 AM
how about modifying the code above?

div, table, anything else you don't want printed, {...}

toicontien
06-10-2003, 12:21 PM
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?

dkozari
06-10-2003, 04:35 PM
You had the right idea. I got the code working. Thanks a lot. Take care of yourself.

dkozari