【问题标题】:How to style a input type=file in html? [duplicate]如何在 html 中设置输入类型=文件的样式? [复制]
【发布时间】:2013-09-05 04:46:49
【问题描述】:

我做了一些研究,发现设置输入 type=file 的样式可能很困难。但是,我意识到当您想将视频上传到网站时,youtube 会显示一个漂亮的按钮。 (可能需要登录:http://www.youtube.com/upload)。
所以基本上它允许用户点击按钮,选择一个文件,然后上传。
我不确定这是如何实现的,而不是使用丑陋的<input> 标签?或者有谁知道制作漂亮的文件上传界面的其他好方法?

【问题讨论】:

标签: javascript css html file-upload


【解决方案1】:

LIVE DEMO

<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;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-06-22
    • 2011-06-17
    • 1970-01-01
    • 1970-01-01
    • 2011-03-14
    • 2016-05-07
    • 2018-09-05
    • 2013-05-09
    相关资源
    最近更新 更多