【发布时间】:2014-01-20 12:57:54
【问题描述】:
我有一个“文件”类型的输入字段。
<input type="text" name="fake_section" class="fake_section"><button class="fake_section">Choose Photo</button>
<input type="file" style="display:none;" name="file" id="file" value="Choose Photo" accept="image/png,image/jpeg" />
<input type="submit" name="submit" value="Submit" />
我使用以下 css
input[type="file"] {
width:50%;
height:25px;
border-radius:2px;
display:inline-block;
border:thin solid #ddd;
}
我的输出如下所示
但实际上我想要这样的输出, 另一个问题是我只想选择“jpeg 和 png”图像文件,但这个输入字段接受所有文件类型。我在 Firefox 和 Chrome 浏览器中都尝试了这个
【问题讨论】: