上传控件CSS用图片代替

<style type="text/css">
a.btn {width: 120px;height: 42px;overflow: hidden;display: block;text-decoration: none;background: url(/images/chose_file.gif) left top no-repeat;}
/*file设为透明,并覆盖整个触发面*/
a.files input{ margin-left: -350px;font-size: 30px;cursor: pointer;filter: alpha(opacity = 0); background:#000;filter:alpha(Opacity=0);opacity:0;-moz-opacity:0;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=0);-MS-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";/*为了兼容各种浏览器*/}
    </style>
    <a href="#" class="btn">
        <input type="file" class="input_files" />
    </a>

 

posted @ 2013-12-06 16:48  xyzhuzhou  阅读(486)  评论(0编辑  收藏  举报