HTML / CSS How to add image icon to input type=“button”?

前端 未结 12 1678
误落风尘
误落风尘 2020-11-28 20:21

I\'m using the below CSS, but it puts an image in the center of the button. Any way to left or right align an icon using , so that

12条回答
  •  粉色の甜心
    2020-11-28 20:58

    If you absolutely must use input, try this:

    background-image: url(...);
    background-repeat: no-repeat;
    background-position: ;
    padding-: px;
    

    It's usually a little easier to use a button with an img inside:

    
    

    However the browser implementations of button for submitting are inconsistent, as well as the fact that all button values are sent when button is used - which kills the "what button clicked" detection in a multi-submit form.

提交回复
热议问题