1

创建此按钮时,我希望它在活动时具有渐变过渡,但似乎它不起作用,我不知道为什么。谷歌浏览器不会阻止该属性,但他们似乎什么都不做。

这是按钮的样子:

 .button {
    color: #fff !important;
    font-size: -63px;
    font-family: "CentraleSans-Bold","Helvetica Neue",Helvetica,Arial;
    line-height: 265%;
    text-decoration: none;
    background-color: #167de4;
    padding: 0 20px;
    display:inline-block;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    -ms-border-radius: 3px;
    -o-border-radius: 3px;
    border-radius: 3px;
    -webkit-background-clip: padding;
    -moz-background-clip: padding;
    border: 1px solid #1d4ea4;
    -moz-box-shadow: 0 1px 1px rgba(0,0,0,0.23),inset 0 1px 0 rgba(255,255,255,0.19);
    background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #3669ef), color-stop(100%, #4f95f4));
    background-image: -webkit-linear-gradient(bottom, #3669ef 0%,#4f95f4 100%);
    background-image: -moz-linear-gradient(bottom, #3669ef 0%,#4f95f4 100%);
    background-image: -o-linear-gradient(bottom, #3669ef 0%,#4f95f4 100%);
    background-image: linear-gradient(bottom, #3669ef 0%,#4f95f4 100%);
    text-shadow: 0 1px 2px rgba(0,0,0,0.75);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    vertical-align: middle;
    }

这就是过渡的样子:

a{
-webkit-transition: all 0.05s ease-in-out;
-moz-transition: all 0.05s ease-in-out;
-o-transition: all 0.05s ease-in-out;
transition: all 0.05s ease-in-out;
}

HTML 如下所示:

<a class="button" href="#" style="opacity: 1;">Create an account</a>

谢谢你的帮助 :)

4

2 回答 2

2

您可以将您的 HTML 添加到问题中吗?您在“按钮”上有渐变,但在“a”上有过渡。

于 2013-06-21T21:41:42.683 回答
1

您需要添加.button:active

演示http://jsfiddle.net/kevinPHPkevin/dfw8B/

.button:active {
      background:red;   
}
于 2013-06-21T21:52:47.413 回答