2014-03-13 137 views
7
.fancybox-inner { 
overflow: hidden; 
background-color:#EEE; 
cursor: //url to an independent cursor image 
} 

但是,如果我的光标(3)都聚集在一个css_sprite图片,我怎么可以参考背景位置,宽度,光标属性的高度值。CSS - 使用光标精灵

cursor .fancybox-inner OR .fancybox-inner:hover cursor{ 
background: url(../img/cursors.png) no-repeat; 
background-position: -32px 0; 
width: 16px; 
height: 16px; 
} 
+0

我认为它不可能使用精灵作为光标图像,不太确定寿。好问题! – DanFromGermany

+0

我以为是这样,我只是好奇......在Google上找不到任何东西.. – Awena

+1

只有一种方法可以让你的光标成为我能想到的精灵... http://www.cursors-4u.com /cursor/2012/02/09/sprite-13.html – SW4

回答

1

虽然光标属性允许x和y的值,它们不用于背景的位置,而是为光标的热点

坐标这是(参见mozilla

cursor: [<uri> [<x> <y>]?,]* keyword 

例如:

.foo { 
    cursor: auto; 
    cursor: url(cursor1.png) 4 12, auto; 
} 

的例子将设置热点是在(4,12)从所述 左上角(0,0)的像素。