Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change the submit button appearance?

Tags:

html

css

I have this plain submit button appearance in my html code

<input type="submit" name="pay now" value="pay" />

I wish to make the submit button look like this

<a href="#"><img src="images/shopping-cart/check-out-btn.png" border="0" /></a>

but should stick with its submit type

how to do that ?

like image 430
sasori Avatar asked Jan 11 '12 06:01

sasori


3 Answers

You should use CSS for that:

input[type="submit"] {
    background: url(images/shopping-cart/check-out-btn.png);
    width: 200px; /* width of image */
    height: 50px; /* height of image */
    border: 0;
}

You should probably use a more specific selector though.

like image 172
Joseph Silber Avatar answered Oct 04 '22 20:10

Joseph Silber


A nice way to do this is using the button element.

<button type="submit"><img src="images/shopping-cart/check-out-btn.png" border="0" /></button>

It works just like a regular input with type=submit, but you have much more freedom.

like image 43
Roel Avatar answered Oct 04 '22 19:10

Roel


You can make an image into a submit button by setting the type attribute of the input element to image:

<input type="image" src="/path/to/image.png"> 

For more information, read the image Button State section of the HTML specification.

like image 40
0b10011 Avatar answered Oct 04 '22 20:10

0b10011