473,467 Members | 1,550 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Don't print certain elements from a page

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
3 6846
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

40
by: komone | last post by:
"Now is the time for all good web developers to use stylesheets". Hmm OK, so I start this commercial site design with the express intent of using CSS entirely. (Something I haven't attempted in...
16
by: Neo Geshel | last post by:
I'm helping on a web site, and it's got our knickers in a knot. We're using the same basic CSS files (with mods) and same headers as from our other sites, but the "print preview" won't work...
9
by: Rhino | last post by:
How hard (and desireable) would it be to give the user certain choices when it comes to printing web pages? The pages on my site use colours and pictures and contain an imbedded menu, among...
11
by: A.M | last post by:
Hi, I found print much more flexible that write method. Can I use print instead of file.write method? Thank you,
9
by: igotyourdotnet | last post by:
I need to create a print preview page BUT my page I need to print has a grid and in the grid I have 2 or 3 columns that have links I want to hide the columns with the links on my print preview page...
2
by: prefersgolfing | last post by:
The Marketing folks are upset; when we print a web page, it truncates the text on the right instead of wrapping. I've set all td widths to % and still no help. When I resize the window, the text...
1
by: ruca | last post by:
Hi, I have a button that when clicked must print the current page after doing something in a certain function. For that I have this code: ...
5
by: itfetish | last post by:
I have made an electronic sign out book for my office in ASP using VBScript. Problem is, when there is a fire we need to check who is out and who is burning. I have been trying to think of how...
6
by: Mike | last post by:
I have a web form that has a dozen or so textboxes and drop downs on it and several buttons. I have a print button on the form as well, when the user clicks the print button I want to take the user...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.