473,388 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

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 17186


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
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
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
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
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
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
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
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
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
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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...

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.