如何申请CSS来ASP:FileUpload控件 [英] How to Apply CSS to ASP:FileUpload Control
问题描述
究竟是如何做到我这个风格控制?
How exactly do I style this control?
我也试过,但它不能正常工作。
I have tried this but it doesn't work.
<asp:FileUpload id="upload_tb" runat="server" />
#upload_tb
{
width: 500px;
}
另外我怎么能风格,带有该控件的浏览按钮?如果它是不可能有其他的选择吗?
Also how can I style the browse button that comes with this control? If it is not possible are there other alternatives?
编辑:
我检查了生成的源代码和asp.net给出了控制这个ID ctl00_main_content_upload_tb
I checked the generated source and asp.net gives the control this id ctl00_main_content_upload_tb
我改变了的CSS
#ctl00_main_content_upload_tb
{
width: 500px;
}
,但它不画出控制。它增加了填充的控制权。任何想法?
but it does not stretch the control. It adds padding to the right of the control. Any ideas?
推荐答案
您不能正式样式类型文件(*)(这是FileUpload控件呈现在页面上什么)的输入,但也有使用位方式使用Javascript和放大器; /或CSS - 见 http://www.quirksmode.org/dom/inputfile。 HTML 或 http://tiagoe.blogspot.com /2010/01/css-style-typefile-tags.html - 但它是不平凡的。
You can't officially style an input of type file (*) (which is what the FileUpload control renders on the page) but there are ways using a bit of Javascript &/or CSS - see http://www.quirksmode.org/dom/inputfile.html or http://tiagoe.blogspot.com/2010/01/css-style-typefile-tags.html - but it isn't trivial.
(*)这是一个安全措施
(*) It's a security measure
这篇关于如何申请CSS来ASP:FileUpload控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!