CSS:如何使游标成为输入文件上的指针? [英] CSS: How make the cursor to become a pointer on the input file?

查看:344
本文介绍了CSS:如何使游标成为输入文件上的指针?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您将光标悬停在输入文件或输入文本上时,如何使其成为指针?



我尝试,但它不工作,

 < input type =filestyle =cursor:pointer;/> 

或者我必须使用javascrip(jquery)??



编辑:



对不起我的错误 - 光标确实改变到了

 < input type =textstyle =cursor:pointer;/> 

但不在



 < input type =filestyle =cursor:pointer;/> 

您可以测试

只有按钮 文件更改为指针,但不改变输入字段 c>。



这里是我的CSS'hack',

 < div id =right-colstyle =position:relative; width:76px; height:24px; overflow:hidden; border:1px solid#000;> 
< input type =filestyle =position:absolute; top:0; right:0; z-index:2; opacity:1; cursor:pointer;/>
< / div>


解决方案

输入类型文件是浏览器最受保护的对象之一。



您可以使用闪光灯按钮来执行更多操作。事实上,有非常好的插件,使文件上传更好的东西,如 Uploadify


How can I make the cursor to become a pointer on an input file or an input text when you hover it?

My try but it does not work of course,

<input type="file" style="cursor: pointer;"/>

Or do I have to use javascrip (jquery)??

EDIT:

Sorry my mistake - the cursor does change to a point on

<input type="text" style="cursor: pointer;"/>

But not on

<input type="file" style="cursor: pointer;"/>

You can test this link on Firefox then you see what I mean.

Only the button of file change to the pointer but not the input field of file.

EDIT 2:

Here is my CSS 'hack',

<div id="right-col" style="position:relative; width:76px; height:24px; overflow:hidden; border:1px solid #000;">
<input type="file" style="position:absolute; top:0; right:0; z-index:2;opacity:1; cursor:pointer;"/>
</div>

解决方案

Cannot be done. The input type file is one of the most protected objects by the browsers. Some browsers allow you to do more things than others, depending on what they consider "safe".

You could use a flash button for it. In fact, there are very nice plugins written to make file uploading a nicer thing, such as Uploadify.

这篇关于CSS:如何使游标成为输入文件上的指针?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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