【问题标题】:Styling an upload button [duplicate]设置上传按钮的样式[重复]
【发布时间】:2014-03-17 08:49:11
【问题描述】:

如何使用 CSS 设置普通上传文件按钮的样式?

<input type="file">

我尝试过使用引导类进行样式设置,但它只是设置样式的按钮周围的区域。

【问题讨论】:

标签: html css


【解决方案1】:

我遇到了同样的问题,经历了很多例子,找到了这个解决方案试试这个..我希望这会对你有所帮助DEMO

HTML

<div class="duplicate">SelectPicture</div><br>
<input id="orginal" type='file'" /><br>

CSS

.duplicate {
    background-color:blue;
    width:100px;
    height:40px;
}
.duplicate:hover{
    background-color:green;
}

#orginal {
 display:none;
}

jQuery

$(document).ready(function(){
$('.duplicate').bind("click" , function () {
        $('#orginal').click();
    });
});

看到这个link

【讨论】:

  • 这很简单,比所有其他解决方案效果更好......谢谢
猜你喜欢
  • 2018-06-07
  • 1970-01-01
  • 2020-07-17
  • 1970-01-01
  • 2021-06-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-02-14
相关资源
最近更新 更多