<!DOCTYPE html>
<html>
<title>W3.CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<body>
<form id="image-form" action="#" class="w3-container w3-border w3-margin-top">
<input id="mediaCapture" type="file" accept="image/*,capture=camera" >
<button id="submitImage" title="Add an image" class="w3-btn w3-dark-grey w3-left">
<i class="material-icons">image</i>
</button>
</form>
</body>
</html>
的<input>
创造了一个“浏览...”文本按钮“没有文件选择”如何将按钮与输入组合?
我也有一个形象的图标按钮的作用。
如何将图标按钮替换为浏览按钮?
一旦我点击图标按钮,它会打开目录让我选择图像。
感谢您的任何帮助。
我正在使用w3.css框架。
请为您的代码创建一个Plunker或JSFiddle示例。谢谢。 – tomepejo
此链接是bootstrap特有的,但您可以根据自己的需要进行调整:https://www.abeautifulsite.net/whipping-file-inputs-into-shape-with-bootstrap-3 – nurdyguy
使输入文件的可见性为零并使用绝对定位将其放在按钮上。还要将其尺寸设置为与按钮相同。 –