input(file)浏览按钮美化代码
问题:tuzicms程序后台上传图片附件时在谷歌浏览器显示高度不是30px,存在浏览器不兼容。
缺点:点击选择文件图片后按钮后面不提示文件名称,需要写js上传提交处理
优点:美观
<!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>无标题文档</title>
</head>
<body>
<style>
.litpic_btn{width: 80px;height: 30px;font-size: 14px;position: relative;overflow: hidden;
line-height: 30px;color: #fff;text-align: center;vertical-align: middle;cursor: pointer;background-color: #2ca22c;border: 1px solid #cccccc;border-color: #e6e6e6 #e6e6e6 #bfbfbf;
border-bottom-color: #b3b3b3;-webkit-border-radius: 4px;-moz-border-radius: 4px;border-radius: 4px;margin: 5px;}
.litpic_btn span{ text-align:center; font-size:14px; margin:0 auto; color:#FFFFFF; padding:0px 20px 0px 4px;}
.litpic_btn a{display:inline-block; width:100px; height:40px;background:#2CA22C; position:relative; overflow:hidden; text-decoration:none;}
.litpic_btn a:hover{background:#2CA22C; text-decoration:none;}
.litpic_btn input{position:absolute; right:0; top:0; font-size:100px; opacity:0; filter:alpha(opacity=80);}
</style>
<div class="litpic_btn">
<a href="#">
<span>上传图片</span>
<input type="file" value="浏览" />
</a>
</div>
</body>
</html>