如何将file对象的显示信息自定义?

<input type="file" />
用浏览器打开效果如图

https://img3.mukewang.com/5bc69a250001c23c00850029.jpg

我有什么办法将browse这几个字改为 “请立即上传文件” ?


慕哥9229398
浏览 728回答 1
1回答

胡子哥哥

&nbsp; &nbsp; <input type="button" name="" value="请立即上传文件"><input type="file" name="files">&nbsp; &nbsp; input[type="file"]{&nbsp; &nbsp; &nbsp; &nbsp; opacity: 0;&nbsp; &nbsp; &nbsp; &nbsp; position: relative;&nbsp; &nbsp; &nbsp; &nbsp; top:0;&nbsp; &nbsp; &nbsp; &nbsp; left:-120px;&nbsp; &nbsp; }&nbsp; &nbsp; input[type="button"]{&nbsp; &nbsp; &nbsp; &nbsp; width:120px;&nbsp; &nbsp; &nbsp; &nbsp; height: 35px;&nbsp; &nbsp; &nbsp; &nbsp; line-height: 35px;&nbsp; &nbsp; &nbsp; &nbsp; background-color: #fff;&nbsp; &nbsp; &nbsp; &nbsp; font-size:14px;&nbsp; &nbsp; &nbsp; &nbsp; -webkit-border-radius: 5px;&nbsp; &nbsp; &nbsp; &nbsp; -moz-border-radius: 5px;&nbsp; &nbsp; &nbsp; &nbsp; border-radius: 5px;&nbsp; &nbsp; }用一个按钮或者a标签或者div把其包裹起来,通过定位使其位置重合,然后将flie的原样式设置为透明度为0(opacity:0)
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript