Dragan Marjanovic Dragan Marjanovic - 20 days ago 5
CSS Question

Styling buttons with images?

Ive been trying to style a submit button using an image. I would use CSS but the button is too complex design wise. I have tried adding a background image to a button but the image was badly positioned. I have also tried using

<input type="image" src="myimage.png">


But alas this is not a submit button so It doesn't work. I have looked and tried everything I believe possible but can't find a solution to making the button submit the form. Thanks.

Answer

You have different possibilities for a submit button:

<input type="image">
<input type="submit">
<button></button> <!-- no type needed, since submit is the default type -->

These are all submit buttons. Pick the one, which suits you best.

Now you can choose to put an image between the button or use background-images and position them properly.

Example for button with background-image: fiddle