如何使用css在网站中添加光标?

时间:2021-07-03 22:55:54

I want to add Custom set of cursor on my website. How can i add a set of Cursors in Website using css/html/js ? So , Default mouse pointer is different, when i hover hyperlink its diff,,.. n so on. I need help with css code. I have the Set of Pointers including both .ani & .cur required for my site. I have already tried :-

我想在我的网站上添加自定义光标集。如何使用css / html / js在网站中添加一组游标?所以,默认鼠标指针是不同的,当我悬停超链接时,它的差异,...等等。我需要css代码的帮助。我有一套指针,包括我的网站所需的.ani和.cur。我已经尝试过了: -

These codes in my style.css

这些代码在我的style.css中

body, a:hover {cursor: url(cursor/blue.cur), progress !important;} 

Still no luck ! I have a master page and what I want is to assign a default custom cursor to the page and have all links use another custom cursor

仍然没有运气!我有一个母版页,我想要的是为页面分配一个默认的自定义光标,并让所有链接使用另一个自定义光标

Is this possible?

这可能吗?

2 个解决方案

#1


0  

<script>
document.getElementsByTagName("body")[0].style.cursor = "url('cursor/blue.cur'), auto";
</script>

this must work IE 6+

这必须工作IE 6+

#2


0  

With css you can do that:

用css你可以做到这一点:

body {cursor: URL(imageFileUrl);}

If you need more information read this.

如果您需要更多信息,请阅读此内容

EDIT: This worked for me: <body style="cursor: url('cursor.jpg'), default">

编辑:这对我有用:

The imagen that I've used is a jpg 32x32.

我使用的图像是jpg 32x32。

#1


0  

<script>
document.getElementsByTagName("body")[0].style.cursor = "url('cursor/blue.cur'), auto";
</script>

this must work IE 6+

这必须工作IE 6+

#2


0  

With css you can do that:

用css你可以做到这一点:

body {cursor: URL(imageFileUrl);}

If you need more information read this.

如果您需要更多信息,请阅读此内容

EDIT: This worked for me: <body style="cursor: url('cursor.jpg'), default">

编辑:这对我有用:

The imagen that I've used is a jpg 32x32.

我使用的图像是jpg 32x32。