自定义光标无法在图像上工作

时间:2017-10-13 13:30:32

标签: css cursor

我在SO上尝试了所有解决方案,但没有成功。我有一个图像在我的图像上显示为光标。我尝试了所有这些。

img:hover{
  cursor: url(../images/wand.ico), auto;
}

img{
  cursor: url(../images/wand.ico), auto;
}

不是.ico,而是.png。在这两种情况下,这些都不起作用。我看过this案例。但这样做并没有帮助。调整图像大小但仍然无法正常工作。在这方面,任何机构都可以帮助我吗?我没有那么多的知识,但我搜索和研究了几乎所有的解决方案。

1 个答案:

答案 0 :(得分:0)

您需要在CSS中设置一些其他属性。

img {
  cursor: url(../images/wand.ico), auto;
  // set the width and height to the size of the png/ico
  width: 20px;
  height: 20px;
  // Set the display type
  display: block;
}

试一试。我相信它不起作用,因为图像没有尺寸,因此,它是不可见的。

相关问题