cursor设置为自定义图片

本文介绍了CSS中使用自定义光标图片时应注意的尺寸限制,指出图片尺寸最好不超过32×32像素以确保跨平台兼容性,并解释了过大的图片可能会被浏览器忽略的原因。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

.box {
      border: 1px solid salmon;
      width: 500px;
      height: 500px;
      cursor: url('拇指.png') ,auto;
}
<body>
    <div class="box">我是文字</div>
  </body>

效果如下:

 

这里的url可以是常用图片格式,可以是base64图片。但是有时候会出现图片不生效的问题,解决如下:

How Big Should cursor image be?

about 32×32px

Cursor size: if the cursor image is over a certain size it will be ignored (in Gecko for example the limit is 128×128px). You should limit yourself about 32×32px anyway, for maximum compatibility with operating systems and platforms.
 

总结:图片不要过大,最好是32*32的图片,如果过大,则直接忽略你的图片

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值