Hide the browse button on a input type=file

前端 未结 10 787
再見小時候
再見小時候 2020-12-11 14:33

Is there a way to hide the browse button and only leave the text box that works in all browsers?

I have tried setting the margins but they show up different in each

10条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-11 15:14

    So I found this solution that is very easy to implement and gives a very clean GUI

    put this in your HTML

    
    

    and this in your CSS

    label.att-each {
    width: 68px;
    height: 68px;
    background: url("add-file.png") no-repeat;
    text-indent: -9999px;
    }
    

    add-file.png can be any graphic you wish to show on the webpage. Clicking the graphic will launch the default file explorer.

    Working Example: http://www.projectnaija.com/file-picker17.html

提交回复
热议问题