473,507 Members | 2,388 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Printer friendly page

I have a web page where I am using a stylesheet and the
attribute and value - media="print" - as below:

<link href="../page_print.css" rel="stylesheet" type="text/css"
media="print">

It works fine except, that the text that I want printed ends up in the
middle of the screen because elements made invisible in the stylesheet
still effect the text's positioning. Stylesheet is like this:

body {visibility:hidden;}

..print {
visibility:visible;
position: absolute;
top: 10px;
left: 10px;
}

As shown I have tried using absolute positioning for the printer style
sheet to force the text further up, but the text at the bottom of the page
then gets split over two pages. Is there a solution? I am using IE 6.

I have also tried using this approach:

body { display:none; }
..print { display:table; }

Nothing is displayed at all by doing this. All I am trying to do is wrap a
table containing text in print tags and ensure only that is printed. Can
someone post an example of achieving this?

Thanks.
Jan 5 '06 #1
5 1471
Deciding to do something for the good of humanity, Someone
<no****@nospam.com> spouted in
comp.infosystems.www.authoring.stylesheets:
All I am trying to do is wrap a
table containing text in print tags and ensure only that is printed. Can
someone post an example of achieving this?


body * {display: none;}
..print {display: block;}

Not tested.

--
Mark Parnell
================================================== ===
Att. Google Groups users - this is your last warning:
http://www.safalra.com/special/googlegroupsreply/
Jan 5 '06 #2
On Thu, 5 Jan 2006 11:57:30 +1100, Mark Parnell wrote:
Deciding to do something for the good of humanity, Someone
<no****@nospam.com> spouted in
comp.infosystems.www.authoring.stylesheets:
All I am trying to do is wrap a
table containing text in print tags and ensure only that is printed. Can
someone post an example of achieving this?


body * {display: none;}
.print {display: block;}

Not tested.


This displays nothing, any chance of a working example?
Jan 5 '06 #3
Deciding to do something for the good of humanity, Someone
<no****@nospam.com> spouted in
comp.infosystems.www.authoring.stylesheets:
This displays nothing, any chance of a working example?


As I said, not tested - let me have a play with it.

--
Mark Parnell
================================================== ===
Att. Google Groups users - this is your last warning:
http://www.safalra.com/special/googlegroupsreply/
Jan 5 '06 #4
Someone <no****@nospam.com> wrote:
It works fine except, that the text that I want printed ends up in the
middle of the screen because elements made invisible in the stylesheet
still effect the text's positioning. Stylesheet is like this:

body {visibility:hidden;}
Yep. That's how the visibility property works. Invisible boxes still affect
layout. See http://www.w3.org/TR/CSS21/visufx.html#visibility
I have also tried using this approach:

body { display:none; }
.print { display:table; }

Nothing is displayed at all by doing this.


Yep. That's how the display property works. Setting "display: none"
prevents the element AND ITS DESCENDANT ELEMENTS from being displayed. See
http://www.w3.org/TR/CSS21/visuren.html#display-prop

What you need to do is use "display: none" on those elements that you don't
want to display. You can't use "display: none" on everything, and then undo
it for the elements you want to display.
--
Darin McGrew, mc****@stanfordalumni.org, http://www.rahul.net/mcgrew/
Web Design Group, da***@htmlhelp.com, http://www.HTMLHelp.com/

"Shin: a device for finding furniture in the dark." - Steven Wright
Jan 5 '06 #5
Deciding to do something for the good of humanity, Someone
<no****@nospam.com> spouted in
comp.infosystems.www.authoring.stylesheets:
This displays nothing,
This works:

body * {display: none;}
..print {display: block;}
..print * {display: inline;}

It may need some tweaking depending on what you are displaying.
any chance of a working example?


http://clarkecomputers.com.au/usenet/print.html

--
Mark Parnell
================================================== ===
Att. Google Groups users - this is your last warning:
http://www.safalra.com/special/googlegroupsreply/
Jan 5 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1422
by: ST | last post by:
Hi, I'm implementing a printer friendly feature for all the pages on a web site. I'm separating the header, content, and footer into separate ascx files, which are contained in the main file. ...
1
1566
by: John Klucker | last post by:
Can anyone tell what easiest way to implement 'Printer Friendly' functionality to my .aspx page. Are there any controls available or is there something in the framework? Thanks in Advance!! ...
2
1390
by: Ray | last post by:
ASP.NET Newbie ? I have a populated datagrid on my .aspx page, I want to open a second window without all the extra fluff (nav bar, menus, etc) and display a printer friendly version of my...
2
1354
by: Ron | last post by:
Hello, I am working on a registration application for my companies intranet. The intranet is ASP classic based as of now. Unfortunately I only know ASP.NET. But that was all okay until I decided I...
2
1261
by: Sandy | last post by:
Hello - I tried to google this, but got back every page on the whole entire web that has printer friendly versions . . . I have a panel containing text from a repeater that also contains text...
1
1301
by: dinoo | last post by:
Can any one help me out? I am looking out to implement printer friendly version of a web page. I do not want the header and footer show up in the print and I do not want to use frames (it is a...
2
1892
by: weetat.yeo | last post by:
Hi all , I have a print button in PHP page which using javascript window.print() to print web page. However , when user click "print" , the print preview display that the page cut-off and...
5
2193
by: weetat.yeo | last post by:
Hi all , I have php page which the data in the page are extracted from MYSQL database. The data are retrieved when user click submit button . In the php page , there is a print button for user...
1
1666
by: tbanov | last post by:
Hi, I'm looking to create my own version of a printer-friendly page. Any resources I can find on this subject are extremely specific about what they consider "printer-friendly", and they don't...
15
2117
by: Prisoner at War | last post by:
Okay, I'd like to create a print-friendly website, so I've been reading up on how to create print-friendly pages (without duplicating my site, of course, by having separate versions of each...
0
7111
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7319
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,...
1
7031
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5623
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,...
1
5042
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
4702
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
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
760
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.