改file样式,上传文件按钮前面没有选择框

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
    <title>改file样式</title>
    <style type="text/css">
    p{margin:0;padding:0;}
    .box { position:relative; overflow:hidden;margin:50px auto;width:80px;height:20px;line-height:20px;}
   
     .filebox {position:absolute;z-index:2;opacity:0;filter:alpha(opacity=0);right:0;}
     .filetext {position: absolute;width:150px;background:#f5f5f5;height:20px;top:0;left:0;z-index:1;width:80px;cursor:pointer}
    </style>
</head>
<body>
    <div class="box ">
        <p class="filebox"><input type="file" value=""  /></p>
        <p class="filetext">上传文件</p>
    </div>
     
</body>
</html>
发布了4 篇原创文章 · 获赞 1 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/HughNian/article/details/7056439