【问题标题】:how can i use icon or image to represent input type button我如何使用图标或图像来表示输入类型按钮
【发布时间】:2017-03-21 20:59:20
【问题描述】:

如何实现为我的输入按钮显示图标或图像。 谢谢

<input id="likebtn" name="likebtn" type="button">

我想为我的点赞按钮实现类似的功能:

【问题讨论】:

  • 你试过&lt;input type="image"&gt;吗?
  • 不,我想为like按钮显示一个图标
  • 谢谢帮忙,能收到点击事件吗?
  • 当然是输入框。默认情况下,它的运行方式类似于&lt;input type="submit"&gt;。你可以给它一个点击处理程序来做任何你想做的事情。

标签: html css image input icons


【解决方案1】:

你可以像这样使用按钮标签:

<button type="button"> whatever text, img and/or icon</button>

【讨论】:

    【解决方案2】:

    使用这个按钮css

     button {
        display: inline-block;
        height: 134px;
        padding: 0;
        margin: 0;
        vertical-align: top;
        width: 104px;
    }
    
    #close-image img {
        display: block;
        height: 130px;  
        width: 100px;
    }
    And your button .
    <button id="close-image"><img src="https://i.stack.imgur.com/up2Fw.png"></button>

    【讨论】:

      猜你喜欢
      • 2013-11-18
      • 2011-02-24
      • 2021-04-26
      • 2015-05-13
      • 2010-09-16
      • 1970-01-01
      • 2021-09-28
      • 1970-01-01
      • 2016-02-21
      相关资源
      最近更新 更多