If I want to make my own clickable buttons, I can do this:
<a href="javascript:;" class="button">Sign up</a>
Where CSS rules for a.button
causes the link to be shown as a button. If I apply the same trick to <input type="submit" />
, I get the button image but it is shown on top of the default submit button and the cursor doesn't change to a hand like it does on <a>
tags.
How can I fix this behavior?
Definition and UsageThe <input type="image"> defines an image as a submit button. The path to the image is specified in the src attribute.
Use the <img> Tag Inside the <button> Tag to Embed Image in the HTML Button. This <img> tag is used to embed an image on an HTML page. The images are not literally placed into the webpage; images are linked to the webpages by given pathways.
To use image as a link in HTML, use the <img> tag as well as the <a> tag with the href attribute. The <img> tag is for using an image in a web page and the <a> tag is for adding a link. Under the image tag src attribute, add the URL of the image. With that, also add the height and width.
You can use appropriate CSS properties such as
border: none;
background: transparent;
cursor: pointer;
to remove the default styles from your input type="submit"
button.
You could use an input type="image"
instead.
It is used like this:
<input type="image" src="{your image}" alt="{alternate text}" />
input type="image"
on MSDNinput
on MDNIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With