我做了一些研究,发现很难样式化input type=file。然而,我发现当你想上传视频到YouTube时,它会显示一个漂亮的按钮。(可能需要登录:http://www.youtube.com/upload)。
基本上,它允许用户点击按钮、选择文件并进行上传。
我不确定这是如何实现的,而不是使用丑陋的标签?还是有其他好的方法来制作漂亮的文件上传界面吗?
我不确定这是如何实现的,而不是使用丑陋的标签?还是有其他好的方法来制作漂亮的文件上传界面吗?
<button id="imageDrop" onclick="document.getElementById('uploadImage').click()" title="Click or Drag Image">Upload image</button>
<input id="uploadImage" type="file" />
#imageDrop{
background:#fff;
width:300px;
height:180px;
font-size:20px;
font-style:italic;
border-radius:18px;
border:2px dashed #444;
}
#uploadImage{
visibility: hidden;
height:0px;
width: 0px;
}