开发者

CSS or image for submit button?

开发者 https://www.devze.com 2023-02-22 08:16 出处:网络
What are the advantage and disadvantage of using both? CSS <input type=\"submit\" class=\"removeBtn\" />

What are the advantage and disadvantage of using both?

  1. CSS

    <input type="submit" class="removeBtn" />
    
    .removeBtn{
        background: url(Images/Remove.png);
        height: 25px;
        width: 25px;
    }
    
  2. Inline

    <input type="image" src="Conten开发者_Go百科t/Images/Remove.png" />
    


Semantically speaking, you should always use a submit button. A user with a screenreader will have no idea what the function of your image input is.

Edit: as per comments, the image button will automatically submit a form as well as an input with type="submit"

0

精彩评论

暂无评论...
验证码 换一张
取 消