自定義 input type=file樣式
阿新 • • 發佈:2019-02-07
這裡採用 span標籤巢狀input標籤,因為div標籤在ie裡有問題,具體參考該文章:http://www.cnblogs.com/kongxianghai/p/5624785.html
裡面很詳細,程式碼如下:
<style> .fileinput-button { position: relative; display: inline-block; overflow: hidden; } .fileinput-button input{ position:absolute; right: 0px; top: 0px; opacity: 0; -ms-filter: 'alpha(opacity=0)'; font-size: 200px; cursor: pointer; } .btn-success{ height: 55px; display: inline-block; border-radius: 5px; line-height: 3.3; border: 1px solid rgb(90, 90, 90); background-color: #00C1B3; font-size: 18px; width: 45%; color: rgb(69, 69, 69); text-align: center; margin-top: 100px; cursor: pointer; } </style> </head>
body裡面是:
<span class="btn-success fileinput-button"> <span>上傳</span> <input type="file">