简体   繁体   English

如何使光标样式使用html或javascript圈出

[英]How to make cursor style to circle using html or javascript

I'm building a drawing app, and I want a cursor in form of circle. 我正在构建一个绘图应用程序,我想要一个圆形的光标。 I searched HTML5 style to make cursor default, pointer etc, but I need it to be a circle. 我搜索了HTML5样式以将光标设置为默认值,指针等,但我需要将其设置为一个圆圈。 How can I do this? 我怎样才能做到这一点?

What you want can be done by CSS. 您想要的可以通过CSS完成。

Check out the following snippet and this jsfiddle 查看以下代码段和此jsfiddle

 #circle64 { cursor: url('http://www.iconsdownload.net/icons/64/16574-black-circle.png'), pointer; } #circle32 { cursor: url('http://www.iconsdownload.net/icons/32/16574-black-circle.png'), pointer; } #circle24 { cursor: url('http://www.iconsdownload.net/icons/24/16574-black-circle.png'), pointer; } 
 <div id='circle64'> Cursor will <br>be</br>different here. </div> <br> <br> <br> <div id='circle32'> Cursor will <br>be</br>different here. </div> <br> <br> <br> <div id='circle24'> Cursor will <br>be</br>different here. </div> 

you can use an image as cursor, by using this css property 您可以使用此css属性将图像用作光标

cursor: url(images/my-cursor.png), auto;

for example if you have some input and you want to show round cursor on it , you should use png image 例如,如果您有一些输入并且想要在其上显示圆形光标,则应使用png图像

input{
cursor: url(images/my-cursor.png), auto;
}

check this jsfiddle http://jsfiddle.net/pwy51Ly8/ 检查此jsfiddle http://jsfiddle.net/pwy51Ly8/

You can use CSS cursor wait 您可以使用CSS光标等待

div {
    cursor: wait;
}

or 要么

div {
 cursor: url("your custom cursor image"), auto;
}

通过链接“由于图像太大而无法使用-图像尺寸受到限制。例如,在Firefox中,尺寸限制为128x128px”

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

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