简体   繁体   English

如何通过CSS设置输入类型“文件”的宽度

[英]How to set width of input type “file” through css

if you click just below demonstration word then also the input type file will click. 如果单击demonstration字正下方,则输入类型文件也将单击。

how to avoid that , so click event fire only on that area whatever size i have given . 如何避免这种情况,因此无论我指定的大小如何,click事件只会在该区域触发。

 <!DOCTYPE html> <html> <body> <style> input{ border:3px solid red; width:10px; } </style> <h3>A demonstration of how to access a File Upload Button</h3> <input type="file" id="myFile"> </body> </html> 

answer won't acceptable if you will wrap this input type file with another element like label , div for security reason. 如果出于安全原因将这个输入类型文件与label,div之类的另一个元素一起包装,则答案是不可接受的。 is it possible then ? 那有可能吗?

Use overflow: hidden; 使用overflow: hidden;

 <!DOCTYPE html> <html> <body> <style> input{ border:3px solid red; width:10px; overflow: hidden; } </style> <h3>A demonstration of how to access a File Upload Button</h3> <input type="file" id="myFile"> </body> </html> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM