我希望将隐藏,并使用图标样式,点击图标选择图片。
.cover_photo {width:100%; height:250px; overflow:hidden; position:relative;}
.cover_photo img {width:100%;}
.upload_btn { position:absolute; top:0; left:0;}
.upload_btn input[type="file"] {display:none;}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<section>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="cover_photo">
<img class="img-responsive" src="http://underafricanskiessafaris.co.za/wp-content/uploads/2015/02/BG-1.jpg" />
<div class="upload_btn">
<form>
<i id="icon_upload" class="fa fa-camera"></i>
<input type="file" name="cover-photo" id="icon_upload" />
</form>
</div>
</div>
</div>
</div>
</div>
</section>
label
解决方案似乎是最好的。我在这里也找到了相关解释:Styling an input type。 - NightKn8