By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,492 Members | 1,987 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,492 IT Pros & Developers. It's quick & easy.

Don't print certain elements from a page

P: n/a
I'd like to print a page but would exclude all elements but one (a
table). I've successfully removed all elements from printing with a
print.css

@page { size: portrait; margin: 2.5cm 1cm 1.5cm 1.5cm; }
* {
display: none;
}

yet that doesn't produce the desired result. How do I include the single
table I'd like to print? Or do I have to remove any none print element
by itself? How should I do this?

O. Wyss

--
Cross-platform applications:
http://wyoguide.sf.net/index.php?page=projectlist.php
Feb 17 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Rik
On Sat, 17 Feb 2007 21:38:04 +0100, Otto Wyss <ot****@bluewin.chwrote:
I'd like to print a page but would exclude all elements but one (a
table). I've successfully removed all elements from printing with a
print.css

@page { size: portrait; margin: 2.5cm 1cm 1.5cm 1.5cm; }
* {
display: none;
}

yet that doesn't produce the desired result. How do I include the single
table I'd like to print? Or do I have to remove any none print element
by itself? How should I do this?
Depends on the page layout. * will select 'body', so this wil have no
display, whatever you set subelements to. I usually can turn elements on &
off by their id, so a default print.css for me usually looks something
like:

#header,#footer,#navigation{display:none;}
#content{display:block;margin:0}

--
Rik Wasmus
Feb 17 '07 #2

P: n/a
Rik wrote:
On Sat, 17 Feb 2007 21:38:04 +0100, Otto Wyss <ot****@bluewin.chwrote:
>I'd like to print a page but would exclude all elements but one (a
table). I've successfully removed all elements from printing with a
print.css

@page { size: portrait; margin: 2.5cm 1cm 1.5cm 1.5cm; }
* {
display: none;
}

yet that doesn't produce the desired result. How do I include the single
table I'd like to print? Or do I have to remove any none print element
by itself? How should I do this?

Depends on the page layout. * will select 'body', so this wil have no
display, whatever you set subelements to. I usually can turn elements on &
off by their id, so a default print.css for me usually looks something
like:

#header,#footer,#navigation{display:none;}
#content{display:block;margin:0}
Yes, but you have to give all your headers on each page the id "header"
or use separate print.css for different pages. I'd like a more general
solution if possible.

O. Wyss
--
Cross-platform applications:
http://wyoguide.sf.net/index.php?page=projectlist.php
Feb 19 '07 #3

P: n/a
Rik
Otto Wyss <ot****@bluewin.chwrote:
Rik wrote:
>Otto Wyss <ot****@bluewin.chwrote:
>>I'd like to print a page but would exclude all elements but one (a
table). I've successfully removed all elements from printing with a
print.css
@page { size: portrait; margin: 2.5cm 1cm 1.5cm 1.5cm; }
* {
display: none;
}

yet that doesn't produce the desired result. How do I include the
single table I'd like to print? Or do I have to remove any none print
element by itself? How should I do this?

Depends on the page layout. * will select 'body', so this wil have no
display, whatever you set subelements to. I usually can turn elements
on & off by their id, so a default print.css for me usually looks
something like:
#header,#footer,#navigation{display:none;}
#content{display:block;margin:0}

Yes, but you have to give all your headers on each page the id "header"
or use separate print.css for different pages. I'd like a more general
solution if possible.
Well, same layout, same id's. Other layout, other id's, and ofcourse
another stylesheet. You can fiddle about with javascript, wouldn't
recommend it though.
--
Rik Wasmus
Feb 19 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.