html - 更改输入类型 ="file"上的光标类型

标签 html css input

<分区>

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

我试过以下方法:

<!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>

出于某种原因,它不会玩球。

最佳答案

知道这是一个老线程。但是谷歌的结果提出了这个问题......我刚刚找到了 chrome 的部分解决方案(不涉及 flash,javascript, overflow hidden 的额外 DOM 操作)

  • firefox 已修复此 bug
  • safari(此时为 7)和 chrome 没有相同的行为
  • safari (7, mac) 对我来说根本不起作用
  • chrome(现在可能是 opera,因为它是 webkit)可以使用::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; 
}

问题是按钮的一般不继承光标属性(?)但输入 [type=file] 字段的其余部分剂量。 这就是为什么 chrome 得到除了按钮之外的指针

关于html - 更改输入类型 ="file"上的光标类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1537223/

相关文章:

html - 居中文本时如何继承父div?

html - 卸载图像下的自定义替代文本

html - 元素特定的 CSS 选择器不好吗?

javascript - 打开输入元素列表 onclick

optimization - 避免编写两次代码,同时保持正确的编码方式?

javascript - 无法从 Bootstrap 4 中的自定义输入文件读取未定义的属性 'path'

javascript - Traverse 未定义且性能落后 THREE.js 时钟? *虽然它有效*

javascript - 按钮未显示在 HTML 中

javascript - js slider 在本地主机上不起作用

html - 如何仅在换行符上添加边距?