Mah*_*ahi 1 html javascript css jquery
如果您单击demonstration单词正下方,则输入类型文件也会单击。
如何避免这种情况,所以单击事件仅在我给定的大小的那个区域上触发。
<!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>Run Code Online (Sandbox Code Playgroud)
出于安全原因,如果您将此输入类型文件与另一个元素(如 label 、 div )包装在一起,则答案将不可接受。那有可能吗?
用 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>Run Code Online (Sandbox Code Playgroud)