Using Label
Nearly all form controls can have a "shortcut" with a label:
#r {display:none}
#l {
display:block;
width:32px;
height:32px;
background:url(https://i.stack.imgur.com/OV6nj.jpg?s=32)
}
<form>
<textarea cols="40" rows="5"></textarea>
<input id="r" type="reset">
<label id="l" for="r"></label>
</form>
This works to stylize checkbox , radiobutton , and many other controls. label
is a great ally of CSS.
Remember that styling is an example, if you want to keep the flow equal to the original button, you can use inline-block
instead of block
.
In addition, if you do not want to image by CSS, you can simply by img
within label
. Usually it is more interesting to leave in CSS, because it is stylization, not content.
Styling the input
Depending on the level of compatibility you want, just stylize with CSS:
#r {
display:block;
border:none;
width:32px;
height:32px;
background:url(https://i.stack.imgur.com/OV6nj.jpg?s=32)
}
<form>
<textarea cols="40" rows="5"></textarea>
<input id="r" type="reset" value="">
</form>