我已经实现了自定义光标,但是在Windows Chrome浏览器上看起来像素化(特别是1366 * 768分辨率)(在Mac OS上未检查)。您可以在此处查看代码段:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled</title>
<meta name="description" content="This is an example of a meta description.">
<style>
body {
cursor: -webkit-image-set( url("https://i.imgur.com/gbSYdYW.png") 1x, url("http://i.imgur.com/vf3qXmT.png") 2x) 0 0, auto;
}
</style>
</head>
<body>
Testing
</body>
</html>
[我也将png更改为svg图片,但没有成功。任何建议将不胜感激。
请找到相同的堆栈片段:
body {
width: 999px;
height: 500px;
cursor: -webkit-image-set( url("https://i.imgur.com/gbSYdYW.png") 1x, url("http://i.imgur.com/vf3qXmT.png") 2x) 0 0, auto;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled</title>
<meta name="description" content="This is an example of a meta description.">
</head>
<body>
Testing
</body>
</html>
好的,尝试一下,一切正常
body {
width: 999px;
height: 500px;
cursor: url("https://i.imgur.com/gbSYdYW.png"), url("https://i.imgur.com/gbSYdYW.png"), default;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CSS Custom Cursor</title>
</head>
<body>
</body>
</html>