Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text and image in button.

Status
Not open for further replies.

LCGeezer

Programmer
Sep 26, 2002
1
GB
I'm looking for a way of having an image AND text in a button (or anything that can look like a button). The idea is to show an image with the text next to it. I can't do the image and text all as one image as I need to load user defined text into the "button". Any suggestions most welcome :0)

TIA
Dave (aka LC Geezer)
 
Put the image and text in a <P> tag or a table cell and use on onclick event to perform the task. For example, if the button is to submit a form:

<P onClick=&quot;document.myForm.submit()&quot;>
---User's text goes here---<IMG SRC=&quot;myImage.gif&quot;>
</P> Mighty :)
 
You can do what you want by placing an image on button using CSS:

.one { background-image: url(&quot;something.gif&quot;) }

Then apply this style to a button:

<input type=&quot;button&quot; class=&quot;one&quot; value=&quot;some text&quot;>

This works, but don't be surprised that you'll have browser compatibility problems - it isn't supported everywhere.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top