html:
<div class="form-group"> <label class="col-sm-3 col-sm-6 control-label">图片</label> <span class="problem-must"> </span> <div class="col-sm-8"> <a class="fb-upload" href="javascript:void(0);"> <input class="form-control" name="pic" type="file" accept=".gif,.jpg,.png,.jpeg" /> <span class="fb-img">上传图片</span> </a> </div> </div>
css:
.form-group input[type="file"] { cursor: pointer; opacity: 0; position: absolute; top: 0; } .fb-img { border: 1px solid #ccc; border-radius: 4px; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset; color: gray; display: inline-block; height: 34px; line-height: 1.42857; padding: 6px 12px; text-align: left; transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s; width: 100%; }
时间: 2024-12-12 18:18:55