input上传按钮的优化

在使用input标签按钮的时候,<input type="file" value="" />

显示很难看,怎么办? 

使用label


<li class="ware-list mt10">
    <span class="vel-tit">上传文件:</span>
    <input class="inputText fix file_up" value="" type="text">
    <input id ="up_file" onchange="change(event)" class="inputText fix" value="" type="file" style="display:none">
    <label for="up_file"><div class="btn-primary" style="float:left;height:34px;line-height:34px" >上传文件</div></label>
</li>

<li class="ware-list mt10"> <span class="vel-tit">上传图标:</span> <label for="up_img">
      <
div style="float:left;"><img ms-duplex="icon" ms-attr-src="{{icon}}"></div>
  </
label> <input id ="up_img" onchange="upimg(event)" class="inputText fix" value="" type="file" style="display:none"> <label for="up_img"><div class="btn-primary" style="float:left;height:34px;line-height:34px" >添加图片</div></label> </li>


在上传文件的地方:我将上传input标签隐藏,将上传按钮label到input标签上,点击上传按钮的时候,其实质是在点击input[file]按钮

 

 

posted @ 2016-04-12 11:21  三人行{必有我师}  阅读(197)  评论(0编辑  收藏  举报