这里采用 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">