HighDots Forums  

Is there a way to set the image for an <input type="image"> in CSS?

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Is there a way to set the image for an <input type="image"> in CSS? in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Alan Silver
 
Posts: n/a

Default Is there a way to set the image for an <input type="image"> in CSS? - 01-19-2006 , 10:07 AM






Hello,

If I have the following HTML...

<input type="image" src="fred.gif">

.... is there a way to specify the image in CSS rather than in the HTML?

TIA

--
Alan Silver
(anything added below this line is nothing to do with me)

Reply With Quote
  #2  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: Is there a way to set the image for an <input type="image"> inCSS? - 01-19-2006 , 11:05 AM






Alan Silver wrote:

Quote:
If I have the following HTML...

input type="image" src="fred.gif"
Then you should fix it to use <input type="submit" value="...">.

Quote:
... is there a way to specify the image in CSS rather than in the HTML?
Yes and no. You could e.g. use a dummy image (transparent single-pixel
image) as fred.gif and use CSS to set a background image for the
element. But don't. To begin with, it would fail whenever CSS is turned
off or your author style sheet is ignored, as well as when browsing in
no-images mode.

The relevant thing is that you should not use image submit buttons in
the first place. For reasons, see
http://www.cs.tut.fi/~jkorpela/forms/imagebutton.html


Reply With Quote
  #3  
Old   
Alan Silver
 
Posts: n/a

Default Re: Is there a way to set the image for an <input type="image"> in CSS? - 01-19-2006 , 11:21 AM



Quote:
If I have the following HTML...
input type="image" src="fred.gif"

Then you should fix it to use <input type="submit" value="...">.
It was air code, purely intended to show the tag I meant. I only use
full, valid HTML in real documents ;-)

Quote:
... is there a way to specify the image in CSS rather than in the HTML?

Yes and no. You could e.g. use a dummy image (transparent single-pixel
image) as fred.gif and use CSS to set a background image for the
element. But don't. To begin with, it would fail whenever CSS is turned
off or your author style sheet is ignored, as well as when browsing in
no-images mode.

The relevant thing is that you should not use image submit buttons in
the first place. For reasons, see
http://www.cs.tut.fi/~jkorpela/forms/imagebutton.html
OK, I'm convinced!!

Don't you wish it was always that easy?

Thanks for the reply.

--
Alan Silver
(anything added below this line is nothing to do with me)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.