输入样式=文件为按钮 [英] Style of input=File as a button

查看:127
本文介绍了输入样式=文件为按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想把一些风格在input =文件aka上传者,我有一个很难与它,是有一些非FLASH解决方案(也许jquery,甚至纯javascript)?

I'm trying to put some style in the input=file aka uploader and I'm having a hard time with it, is there some NON FLASH solution (maybe jquery or even plain javascript)?

推荐答案

使用clip属性将按钮与输入框分开,使用 opacity:0 ,然后将其绝对定位在样式按钮上。

Use the clip property to separate the button from the input box, hide it using opacity: 0, then absolutely position it over the styled button.

* > /**/ input[type="file"], x:-webkit-any-link {
  outline: none; 
  cursor: pointer; 
  position: absolute; 
  top:0; 
  clip: rect(0px 86px 22px 0px); /* Webkit; use 0px 222px 22px 145px for other browsers */
  z-index:2;
  opacity:0;
}

样式化输入字段可以位于样式按钮旁边。使用事件处理程序保持输入字段的显示值与所选文件名同步。

A styled input field can be positioned next to the styled button. Use event handlers to keep the displayed value of the input field in sync with the chosen file name.

这篇关于输入样式=文件为按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆