CSS3: Glowing background on link-hover (not text-glow)
Asked Answered
I

1

6

I have a menu, containing several links. I want these links to have a glowing effect in the background when I hover them.

I have almost made it using css transition, box-shadow and a lighter background-color on the links.

The problem is that the transition-effect affects the box-shadow, so that when the transition starts, the links has no box-shadow, which gives them a squared background-color. When the transition has ended, the glowing background looks fine.

Please see my jsFiddle: http://jsfiddle.net/xCJ46/.

I would very much appreciate your help with this.

Here is an extract of my 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>
Irfan answered 6/2, 2013 at 12:13 Comment(1)
Add the box-shadow to the link's property (not hover). F.e. div a { box-shadow: inset 0 0 30px 15px #49628a; }Carricarriage
C
10

Add the box-shadow to the link's property (not hover).

div a { box-shadow: inset 0 0 30px 15px #49628a; }
Carricarriage answered 6/2, 2013 at 12:38 Comment(1)
Thanks! That worked perfectly. Please see the updated jsFiddle: jsfiddle.net/xCJ46/3Irfan

© 2022 - 2024 — McMap. All rights reserved.