2012-08-09 65 views
2

这种转变工作在Safari &铬(= WebKit浏览器),但不能在Firefox(Mozilla的=)。为什么?CSS3多的box-shadow过渡不工作

a.lorem { 
    width: 100px; 
    padding: 20px; 
    display: block; 
    color: white; 
    text-align: center; 
    background: rgb(191,210,85); 
    background: -moz-linear-gradient(top, rgb(191,210,85) 0%, rgb(142,185,42) 50%, rgb(114,170,0) 51%, rgb(158,203,45) 100%); 
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgb(191,210,85)), color-stop(50%,rgb(142,185,42)), color-stop(51%,rgb(114,170,0)), color-stop(100%,rgb(158,203,45))); 
    background: -webkit-linear-gradient(top, rgb(191,210,85) 0%,rgb(142,185,42) 50%,rgb(114,170,0) 51%,rgb(158,203,45) 100%); 
    background: -o-linear-gradient(top, rgb(191,210,85) 0%,rgb(142,185,42) 50%,rgb(114,170,0) 51%,rgb(158,203,45) 100%); 
    background: -ms-linear-gradient(top, rgb(191,210,85) 0%,rgb(142,185,42) 50%,rgb(114,170,0) 51%,rgb(158,203,45) 100%); 
    background: linear-gradient(to bottom, rgb(191,210,85) 0%,rgb(142,185,42) 50%,rgb(114,170,0) 51%,rgb(158,203,45) 100%); 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#bfd255', endColorstr='#9ecb2d',GradientType=0); 
    box-shadow: inset 0 -3px 0 #A9A9A9, 
       0 3px 0 #EFEFED; 
    -webkit-transition: box-shadow .5s linear; 
    -moz-transition: box-shadow .5s linear; 
    -o-transition: box-shadow .5s linear; 
    -ms-transition: box-shadow .5s linear; 
    transition: box-shadow .5s linear; 
} 

a:hover.lorem { 
    box-shadow: 0 3px 0 rgba(0, 0, 0, .1), 
       inset 0 -3px 0 rgba(0, 0, 0, .1), 
       inset 0 0 100px rgba(255, 255,255 , .3); 
} 

Fiddle

回答

1

首先,你需要写a.lorem:hover而不是a:hover.lorem

后,边框阴影多值需要对应于它们的 “:悬停” 对。 “插入”边界阴影不能过渡到“开始”边界阴影。

为例:

a.lorem{ 
    box-shadow: 
     inset 0 -3px 0 #A9A9A9, 
      0 3px 0 #EFEFED, 
     inset 0 0 0 rgba(0,0,0,0); /* for third ":hover" value */ 
    transition:box-shadow .5s linear; /* add prefixed verison (-moz-, -webkit-, ...*/ 
} 
a.lorem:hover{ 
    box-shadow: 
     inset 0 -3px 0  rgba(0, 0, 0, .1), 
      0 3px 0  rgba(0, 0, 0, .1), 
     inset 0 0 100px rgba(255, 255,255 , .3); 
} 
+0

这仍然没有出于某种原因... – vsync 2013-01-18 23:45:11