为什么悬停不适用于移动的物体?
我正在 CSS 中制作一个太阳系,这是我的代码: http://jsfiddle.net/kAKdm/。
然而,似乎 :hover
只适用于太阳,这是唯一不随 CSS 动画移动的项目。
有谁知道如何使 :hover
也适用于行星?我想做这样的事情,但它当然会被动画覆盖:
#planets > div:hover {
-webkit-transform: scale(1.2);
}
提前致谢。
I am making a solar system in CSS, and here is my code: http://jsfiddle.net/kAKdm/.
However, it seems that :hover
will only work with the sun which is the only item which does not move with CSS animations.
Does anyone know a way to make the :hover
work with the planets also? I want to do something like this, but it will of course be overridden by the animation:
#planets > div:hover {
-webkit-transform: scale(1.2);
}
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
基本上,如果你缩放行星,你就会改变它的宽度、高度、顶部、左侧、边框半径属性。
缩放确实很方便,但由于您覆盖了变换,您可以尝试以下操作:
您将必须计算宽度高度并将每个行星重新定位缩放量的一半,但它可以工作。
http://jsfiddle.net/kAKdm/21/ - 尝试悬停金星。
Basicaly if you are scaling the planets you are changing it's
width, height, top, left, border-radius
properties.scale sure is handy but since you override the transform you could try this:
You will have to calculate the width height and reposition each planet by half the ammount of scale but it works.
http://jsfiddle.net/kAKdm/21/ - try hover venus.
Chrome 不接受
div:hover
,它只接受img:hover
。因此,不要使用#planets > div:hover
,使用:有关更多详细信息,请访问:
Chrome doesn't accept
div:hover
, it only acceptsimg:hover
. So instead of#planets > div:hover
, use:For more details visit: http://dinolatoga.com/2009/09/18/amazing-imag-hover-effects-with-webkit-and-css/