gpt4 book ai didi

c# - 样式化 asp :fileupload control

转载 作者:行者123 更新时间:2023-12-03 20:21:51 31 4
gpt4 key购买 nike

我在 asp.net 中有一个文件上传控件,如下所示:

<asp:FileUpload ID="File1" runat="server" Font-Size="Small" Width="100%" />  

出于某种原因,浏览...按钮不应用我已应用于任何 input[type="button"] 控件的标准 CSS。

如何将相同的 CSS 应用于该控件的浏览按钮?

最佳答案

尝试这个

<input type="file" class="hidden" id="uploadFile"/>
<div class="button" id="uploadTrigger">Browse</div>

一些CSS
.hidden {
display:none;
}
.button {
border: 1px solid #333;
padding: 10px;
margin: 5px;
background: #777;
color: #fff;
width:75px;
}

JS
$("#uploadTrigger").click(function(){
$("#uploadFile").click();
});

Demo

关于c# - 样式化 asp :fileupload control,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22304294/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com