remove value attribute of input element using CSS only

前端 未结 4 1347
不思量自难忘°
不思量自难忘° 2021-01-13 04:46

I have a \"Submit\" button which I\'m trying to replace with an image


I can\'t modify th

4条回答
  •  旧巷少年郎
    2021-01-13 05:14

    Adding to SpaceBeer's answer, it is good to use a negative text-indent and remove the text, if there's any.

    input[type="submit"] {
      font-size:0;
      width:120px;
      height:30px;
      background: url('dir/image.png') no-repeat left top;
      border: none;
      overflow: hidden;
      text-indent: -99em;
    }
    

    And this is the right way, almost all the places suggest. Also, you can find a demo here: http://jsfiddle.net/6MKKh/

提交回复
热议问题