简体   繁体   English

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

[英]How to add Cursor in Website using css?

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 ? 如何使用css / html / js在网站中添加一组游标? So , Default mouse pointer is different, when i hover hyperlink its diff,,.. n so on. 因此,当我将超链接悬停在其差异,.. n等上时,默认鼠标指针是不同的。 I need help with css code. 我需要CSS代码方面的帮助。 I have the Set of Pointers including both .ani & .cur required for my site. 我有一套指向我网站所需的.ani.cur指针。 I have already tried :- 我已经尝试过:-

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? 这可能吗?

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"> 编辑:这对我<body style="cursor: url('cursor.jpg'), default"><body style="cursor: url('cursor.jpg'), default">

The imagen that I've used is a jpg 32x32. 我使用的图像是jpg 32x32。

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

this must work IE 6+ 这必须能在IE 6+

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

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