【发布时间】:2013-01-21 15:17:31
【问题描述】:
我有一个菜单,包含几个链接。我希望这些链接在悬停时在背景中具有发光效果。
我几乎已经在链接上使用了 css 过渡、框阴影和较浅的背景色。
问题是过渡效果会影响 box-shadow,所以当过渡开始时,链接没有 box-shadow,这给了它们一个平方的背景颜色。过渡结束后,发光的背景看起来很好。
请看我的 jsFiddle:http://jsfiddle.net/xCJ46/。
非常感谢您的帮助。
这是我的 CSS 的摘录:
<html><style>
div a:hover {
background: #527fa9;
-webkit-box-shadow: inset 0 0 30px 15px #49628a;
-moz-box-shadow: inset 0 0 30px 15px #49628a;
box-shadow: inset 0 0 30px 15px #49628a;
-webkit-transition: 500ms linear 0s;
-moz-transition: 500ms linear 0s;
-o-transition: 500ms linear 0s;
transition: 500ms linear 0s;
}
</style></html>
【问题讨论】:
-
将 box-shadow 添加到链接的属性(不是悬停)。 F.e. div a { box-shadow: inset 0 0 30px 15px #49628a; }
标签: css-transitions css glow