I would like to have a submit button which contains text and an image. Is this possible?
I can get the exact look I want with code that looks like:
<button type="button">
<img src="save.gif" alt="Save icon"/>
<br/>
Save
</button>
... but I haven't found a way to have one of those for my forms. Is there a way to do that with an
<input type="submit" ...>
element? Or am I forced to go the image or text way? Thanks for your help!
Let's say your image is a 16x16 .png icon called icon.png Use the power of CSS!
CSS:
HTML:
This will put the image to the left of the text.
In case dingbats/icon fonts are an option, you can use them instead of images.
The following uses a combination of

)
for the sign in logo),In HTML:
In CSS:
jsFiddle
Notice the
font-family
specification: all characters/code points will usegeorgia
, falling back toFontAwesome
for any code pointsgeorgia
doesn't provide characters for.georgia
doesn't provide any characters in the private use range, exactly whereFontAwesome
has placed its icons.Here is an other example:
You can do this:
HTML code:
note: you can use and action and method of your choice and Id and any text starting from href="javascript: and ending to ()" but make sure that when I type the same things such as id and some text you type in your replacement in the same places(java script and HTML code).
java script code: