简体   繁体   English

CSS光标:可以是半透明图像吗

[英]CSS Cursor: Can it be a semi-transparent image

I am trying to create an effect when you place the mouse cursor over an img it glows in the small region where the mouse is. 当您将鼠标指针放在img上时,它会在鼠标所在的小区域发光。

I acheive this by changing the cursor to a .gif when its over the img. 我通过在img上方将光标更改为.gif来实现此目的。 I have used the CSS cursor attribute for the img, but the cursor image(a .gif I made in photoshop) is flat when it is supposed to be transparent. 我为img使用了CSS光标属性,但是当光标图像(应该是photoshop中创建的.gif)是透明的时,它是平坦的。

Is it possible to have a semi transparent cursor in HTML/CSS? 在HTML / CSS中是否可以使用半透明光标? Maybe I need to use a .cur file or maybe .ico? 也许我需要使用.cur文件或.ico?

Should I just hook the onmouseover event & place an img(with the transparent glow look) under the mouse as it moves? 我是否应该仅挂接onmouseover事件并在鼠标移动时将其放置在鼠标下方的img(具有透明的发光外观)?

如果你需要的图像是动画,但使用的是32位PNG代替(你应该比GIF更喜欢不管你可以做替代;)应该工作。

You could create your own custom cursor. 您可以创建自己的自定义光标。

Then apply this style: 然后应用以下样式:

.customCursor {
   cursor: url('mycursor.cur');
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM