CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 9th, 2008, 10:07 AM
black_lotus black_lotus is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 240 black_lotus User rank is Sergeant (500 - 2000 Reputation Level)black_lotus User rank is Sergeant (500 - 2000 Reputation Level)black_lotus User rank is Sergeant (500 - 2000 Reputation Level)black_lotus User rank is Sergeant (500 - 2000 Reputation Level)black_lotus User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 11 h 30 m 10 sec
Reputation Power: 18
Submit button background-image

I'm having trouble setting the background image of a submit button. This is my code:

Code:
<input class="submit" type="submit" name="submit" value="Submit" style="background-image:url('img/enter.jpg');" />


I've also tried putting the css in my external css file in the .submit tag... didn't work. I know the path to the image is correct because the following works:
Code:
<input type="image" src="img/enter.jpg" /> 


What gives? Thanks

Reply With Quote
  #2  
Old May 9th, 2008, 10:43 AM
Akh's Avatar
Akh Akh is offline
|<.+#f@#+.&.|
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2002
Location: norway
Posts: 2,590 Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 12 h 34 m 35 sec
Reputation Power: 511
Try using the Button element instead, it allows more styling.
http://www.w3.org/TR/html401/interact/forms.html#h-17.5
__________________

Reply With Quote
  #3  
Old May 10th, 2008, 01:06 AM
Arem Arem is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 22 Arem User rank is Corporal (100 - 500 Reputation Level)Arem User rank is Corporal (100 - 500 Reputation Level)Arem User rank is Corporal (100 - 500 Reputation Level)Arem User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 7 h 14 m 15 sec
Reputation Power: 0
The problem with your style code might be the quotes inside the brackets. I don't think you should have them. So change
Code:
style="background-image:url('img/enter.jpg');"

to
Code:
style="background-image:url(img/enter.jpg);"

******************

Akh's suggestion of using button is good. But if you'd like to stick with input, make sure your css looks something like this:
Code:
.submit input {background-image: url(img/enter.jpg);}

UPDATE: sorry, this is wrong. See next posts below...

******************

I must admit that I have not used a background image on a submit input, so I am hypothesizing a little. Let me know if you try this and it works!

Reply With Quote
  #4  
Old May 10th, 2008, 01:36 AM
Kravvitz's Avatar
Kravvitz Kravvitz is offline
CSS & JS/DOM Adept
Click here for more information.
 
Join Date: Jul 2004
Location: USA
Posts: 15,149 Kravvitz User rank is General 5th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 5th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 5th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 5th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 5th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 5th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 5th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 5th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 5th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 5th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 5th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 5th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 5th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 5th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 5th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 5th Grade (Above 100000 Reputation Level) 
Time spent in forums: 3 Months 2 Weeks 2 Days 2 h 47 m 18 sec
Reputation Power: 1294
@Arem

The single quotes are optional. It's best to leave them out because IE5/Mac has trouble with them.

Your selector means an <input> element that is a descendant of an element that belongs to the "submit" class. Don't you mean "input.submit" -- an <input> element that belongs to the "submit" class?
__________________
Spreading knowledge, one newbie at a time.

Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions

IE7: the generation 7 browser new in a world of generation 8 browsers.
Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.

Reply With Quote
  #5  
Old May 10th, 2008, 02:31 AM
Arem Arem is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 22 Arem User rank is Corporal (100 - 500 Reputation Level)Arem User rank is Corporal (100 - 500 Reputation Level)Arem User rank is Corporal (100 - 500 Reputation Level)Arem User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 7 h 14 m 15 sec
Reputation Power: 0
Quote:
Originally Posted by Kravvitz
Don't you mean "input.submit" -- an <input> element that belongs to the "submit" class?


Yes, thanks Kravvitz, my code is wrong. My post was originally much longer, and suggested placing the <input> inside a div with .submit class. I cut it down for simplicity's sake, and did not check carefully enough what I had left.

So I guess the css should read:

Code:
input.submit {background-image: url(img/enter.jpg);}


BTW Kravvitz, what's the best way to add an image to a <button>? Is it easy enough to add a background-image to a <button>, or is it better to put the image in the html? As I understand it, the button has this format: <button>Text</button>. To add an image in the html, do you do something like this?

Code:
<button value="sent" name="submit" type="image" src="images/button.jpg"></button>


I have left the middle bit blank (i.e. between <button> and </button>, with no text. Is this kosher?

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > Submit button background-image


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway