473,507 Members | 8,335 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hide input buttons when printing

Hello,

I am creating a stylesheet for printing out some webpages. I would
like the printed pages to NOT display buttons. However, text fields
should be printed. Therefore, the following code will not work:

input { display : none; }

....since text fields will also be hidden. I am looking for a solution
along the lines of:

input:button { display : none; }

Is anything like this possible? Thanks.
Jul 20 '05 #1
3 17188


Trent wrote:

I am creating a stylesheet for printing out some webpages. I would
like the printed pages to NOT display buttons. However, text fields
should be printed. Therefore, the following code will not work:

input { display : none; }

...since text fields will also be hidden. I am looking for a solution
along the lines of:

input:button { display : none; }


input[type=button] {
display: none;
}
will hide
<input type="button">
elements with browsers supporting that CSS 2 selector (Mozilla, Netscape
6/7, Opera). See
http://www.w3.org/TR/CSS2/selector.h...bute-selectors

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
sp*******@marx7.org (Trent) wrote in
news:22************************@posting.google.com :
I am creating a stylesheet for printing out some webpages. I would
like the printed pages to NOT display buttons. However, text fields
should be printed. Therefore, the following code will not work:

input { display : none; }

...since text fields will also be hidden. I am looking for a solution
along the lines of:

input:button { display : none; }

Is anything like this possible? Thanks.


In principle you could use attribute selectors:

input[type="button"] {display: none;}

but unfortunately IE doesn't support them. I suggest you give any input
elements that shouldn't be printed a class of "noprint" or the like and
then use that in your stylesheet. More effort, but should work nearly
everywhere.
Jul 20 '05 #3

"Trent" <sp*******@marx7.org> wrote in message
news:22************************@posting.google.com ...
Hello,

I am creating a stylesheet for printing out some webpages. I would like the printed pages to NOT display buttons. However, text fields should be printed. Therefore, the following code will not work:
input { display : none; }

...since text fields will also be hidden. I am looking for a solution along the lines of:

input:button { display : none; }

Is anything like this possible? Thanks.


I had a similar issue getting a button to have a top margin of 1
em while no other inputs were affected. I did this.

input.button {
margin-top: 1em
}
.. . .
<input class="button" ...
Jul 20 '05 #4

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

Similar topics

2
30014
by: Xerxes | last post by:
Hi, can you tell me how I can make a <label> hidden? I have hidden the field after the label: var M_Hide = isNS4?'hide':'hidden'; var M_Show = isNS4?'show':'visible'; ..... <label...
3
23851
by: Owen Funkhouser | last post by:
I have a form with three radio options. And I have three buttons: <input type="submit" name="mainform_action" value="Edit Data"> <input type="submit" name="mainform_action" value="View Data">...
1
11891
by: Don Grover | last post by:
I have a table thats wrapped in a div tag, that when user selects 1 of 2 radio buttons it hides or shows table, this works ok. But I want to set the table show hide on what the existing state of...
10
13418
by: DettCom | last post by:
Hello, I would like to be able to display or hide fields based on whether a specific Yes/No radio button is selected. This is in conjunction with a posting a just made here in the same group...
2
12168
by: MOHSEN KASHANI | last post by:
Hi, I am trying to hide some form elements in a form by default and show/hide depending on which radio button is clicked. This is what I have but it is not working: <head> <style> ..noshow {...
0
1752
by: David Perez | last post by:
Hi all, We have two buttons in an aspx page like this <input id="Print" type="button" value="Print" onclick="javascript:self.print()"> <input id="Close" type="button" value="Close"...
11
19179
by: C.W.Holeman II | last post by:
I what to hide an input element and the following text. I have the selector for the input working and just need to grab the text following it. CSS: form{ display:table; text-align:center; }
3
8795
by: deciacco | last post by:
I'm trying to write a label printing SDI app with a small preview on the main form itself. Every time I run the InvalidatePreview event on the preview control to redraw the preview I get the...
7
4652
by: somnamblst | last post by:
I am using jQuery & hideAllExcept.js from this demo tute http://enure.net/dev/hide-all-except-one/ The issue is that on a page with other content, the images I have placed in the toggleThis...
0
7109
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
7313
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
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7481
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
5619
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
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
3190
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...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.