7 replies [Last post]
blackthumb
Offline
newbie
Last seen: 12 years 40 weeks ago
Joined: 2007-08-09
Posts: 6
Points: 0

I have a web page in which I want to print the content of tables, textarea, input text fields, BUT I DON'T WANT TO PRINT THE BUTTON LIKES SUBMIT, CANCEL ETC.

Is it possible to achieve this effect using CSS ?

thepineapplehead
thepineapplehead's picture
Offline
Guru
Last seen: 35 weeks 5 days ago
Joined: 2004-06-30
Posts: 9668
Points: 801

Not with pure CSS alone,

Not with pure CSS alone, thanks to stupid IE.

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

in a print stylesheet would do what you want. However IE won't support that, so use HTML like:

.noprint {display: none;}

Verschwindende wrote:
  • CSS doesn't make pies

Deuce
Deuce's picture
Offline
Guru
Somewhere, USA
Last seen: 3 years 19 weeks ago
Somewhere, USA
Timezone: GMT-5
Joined: 2005-11-20
Posts: 4424
Points: 1843

i would think so.

i would think so.

try giving your Submit, Cancel, etc buttons a class such as "button" or something.
Then in your print css document just do

.button { display: none; }

EDIT: Thanks for c**k blocking me TPH

all » http://dictionary.reference.com/browse/all

Google isn't a bunch of guys reading and grading web sites, it's more like a bunch of monkeys sniffing food and putting the good bananas at the top. -Triumph

blackthumb
Offline
newbie
Last seen: 12 years 40 weeks ago
Joined: 2007-08-09
Posts: 6
Points: 0

Clarification

Thanks for the tip. However, I mis-stated my intention.

I want to display the buttons on the web page, but when I print (css, media="print"), I don't want the buttons printed.

I can change the display property of buttons to "none" when I print, then have to reset the display property to normal after I print. All
requires Javascript.

Is it possible to achieve the same effect w/o Javascript and use CSS alone ? Thkx

blackthumb
Offline
newbie
Last seen: 12 years 40 weeks ago
Joined: 2007-08-09
Posts: 6
Points: 0

I got it

This is, I guess, what you guys hinted. I have a class button and in print css, set the display to none and it works. Thanks

< style type="text/css" media="print" >
div#tbl-container { overflow: visible; }
.reportTable tbody { overflow: visible; }
.button { display: none; }
< /style >

PS"
Spaces inside style tags purposely created to retain the code when sbumit

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 5 years 46 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

what blocking? Generally

Shock what blocking? Smile

Generally I would have a class of some description on input submits and most form controls, using those existing classes should be sufficient to place a display:none on in a print style sheet.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

Deuce
Deuce's picture
Offline
Guru
Somewhere, USA
Last seen: 3 years 19 weeks ago
Somewhere, USA
Timezone: GMT-5
Joined: 2005-11-20
Posts: 4424
Points: 1843

you stated it clearly and we

you stated it clearly and we both posted the same thing
you should do research on print style sheets

(hint: you're going to have two stylesheets)

all » http://dictionary.reference.com/browse/all

Google isn't a bunch of guys reading and grading web sites, it's more like a bunch of monkeys sniffing food and putting the good bananas at the top. -Triumph

thepineapplehead
thepineapplehead's picture
Offline
Guru
Last seen: 35 weeks 5 days ago
Joined: 2004-06-30
Posts: 9668
Points: 801

That's what we were hinting

That's what we were hinting towards, yes Wink

Verschwindende wrote:
  • CSS doesn't make pies