Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
更改输入文件宽度HTML CSS_Html_Css - Fatal编程技术网

更改输入文件宽度HTML CSS

更改输入文件宽度HTML CSS,html,css,Html,Css,我已经成功地更改了输入文件标签的宽度和高度,使用了不同的在线说明。但是,当我在按钮上显示文本时,按钮不能保持单击状态。 这是我的HTML代码 <button id="fileInput"> <label><strong>Browse</strong></label> <input type="file" value="Browse"/> </button> 按钮已单击,但未单击。HTML <

我已经成功地更改了输入文件标签的宽度和高度,使用了不同的在线说明。但是,当我在按钮上显示文本时,按钮不能保持单击状态。 这是我的HTML代码

<button id="fileInput">
    <label><strong>Browse</strong></label>
    <input type="file" value="Browse"/>
</button>
按钮已单击,但未单击。

HTML

<form id="test_form">
  <input type="file" id="test">
  <button>Browse</button>
</form>
JQuery

$("button").click(function() {
    $("#test").click();
})

$('#test').change(function() {
    $('#test_form').submit();
});

JSFIDLE:

您试图将文件输入放入按钮,但我认为它不起作用。因此,您可以更改输入视图,而不是添加按钮,如此处的接受答案: 或者你可以做点什么,我建议你这样做: HTML
input{position:absolute; top:-100px;}
$("button").click(function() {
    $("#test").click();
})

$('#test').change(function() {
    $('#test_form').submit();
});
button id="fileInput"><label><strong>Browse</strong></label> </button>
<input type="file" id="input" style="display:none;"/>
<script>
$(document).ready( function() {
  $('#fileInput').click(function(){
    $("#input").click();
  });
});
</script>