由于不同语言界面中
<input type=”file”>始终是系统默认的文字,无法更改,在IE中可以给它一个border来简单美化一下,但是在Firefox中就无能为力了。
在网上找了一些文件上传按钮美化的,都不是很好,不兼容Firefox。
以下是我的方法(非常简单,且各浏览器都有很好表现):
HTML:
<style> .opacity {filter:alpha(opacity=0);-moz-opacity:0;opacity:0;} .text {border: 1px solid #c0c1b3;} .text.opacity {position:absolute;height:20px;} .text.file {width:129px!important;width:135px;z-index:100;} .text.file_btn {height:19px;margin:0 0 -1px 0;width:auto!important;width:60px;border:2px solid #CCCC00;} </style> <input type="file" name="file_0_ture" size="20" onchange="this.nextSibling.value=this.value" class="text opacity"><input name="file_0" value="" class="text"> <input type="button" value="浏览..." class="file_btn">
You are currently browsing the xhlv's blog weblog archives for 'beautification' tag.