首页 > 解决方案 > 鼠标悬停在 Chrome 浏览器上的日期和时间选择器图标上时的光标指针

问题描述

我有一个简单的光标问题:chrome 浏览器中的指针 css,但我 2 天都无法解决这个问题。我将在下面附上我的代码。请在 Chrome 浏览器上运行。您将无法在 Firefox 浏览器上看到图标。只有铬有效...

<head>
  <title>Page Title</title>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

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

</head>

<body>
  <input type="date" id="filepicker" name="fileList" webkitdirectory />
  <br/>
  <input type="time" id="filepicker" name="fileList" webkitdirectory />
</body>

结果将如上所示。 在此处输入图像描述

如果我将鼠标悬停在图标(红色部分)上,那么它们只会出现箭头。我想将其更改为指针。如果您有经验,请帮助我。

谢谢

标签: javascripthtmlcssgoogle-chrome

解决方案


<style type="text/css">
  input {
    cursor: pointer;
  }
  
  input::-webkit-calendar-picker-indicator {
    cursor: pointer;
  }
</style>

<input type="date" id="filepicker" name="fileList" webkitdirectory />

<br/>

<input type="time" id="filepicker" name="fileList" webkitdirectory />


推荐阅读