在输入类型=“文件"上更改光标类型 [英] Change cursor type on input type="file"

查看:24
本文介绍了在输入类型=“文件"上更改光标类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简单的问题...如何更改文件输入类型上的光标类型?

Simple question... How do I change the cursor type on a file input type?

我尝试了以下方法:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <style>
            input[type="file"] {
              cursor: pointer;
            }
        </style>
    </head>
    <body>
        <input type="file">
    </body>
</html>

出于某种原因,它不会打球.

For some reason, it won't play ball.

推荐答案

知道这是一个旧线程.但谷歌结果提出了这一点......我刚刚找到了 chrome 的部分解决方案(不是 invalving flash、javascript、额外的 DOM 操作并隐藏溢出)

Know this a old thread. But the google results brings this up... I Just found a partial solution to chrome (not invalving flash, javascript, extra DOM manipulation with overflow hidden)

  • firefox 已修复此错误
  • safari(此时为 7)和 chrome 没有相同的行为
  • safari (7, mac) 对我来说根本不起作用
  • chrome(也许现在是 webkit 时的 opera)可以使用 ::webkit-file-upload-button 伪类

.

input[type=file], /* FF, IE7+, chrome (except button) */
input[type=file]::-webkit-file-upload-button { /* chromes and blink button */
    cursor: pointer; 
}

问题是按钮一般不继承光标属性(?)但是其余的 input[type=file] 字段剂量.这就是为什么 chrome 获取除按钮之外的指针

The problem is that button's doesn't inherit the cursor property in general(?) but the rest of the input[type=file] field dose. Thats why chrome get the pointer except the button

这篇关于在输入类型=“文件"上更改光标类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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