CSS:主动不在<a> tags</a>上工作

时间:2014-03-02 06:55:45

标签: html css button

我正在处理一组按钮,供人们在他们的页面中使用,但css:active属性不适用于<a>标记。

如果您想玩它,我会在CSSDeckJSfIddle上找到它。任何帮助表示赞赏!

1 个答案:

答案 0 :(得分:3)

<强> CODE

<a class="button" href="#">KABLAM</a>

您的css端口button:active仅适用于active标记的button状态。您的active代码或a类没有定义button属性。您应该将定义定义为a:active.button:active

button:active, a:active{
    background-image: -webkit-gradient(
        linear,
        left top,
        left bottom,
        color-stop(0, #2E9185),
        color-stop(1, #00FFE6)
    );
    background-image: -o-linear-gradient(bottom, #2E9185 0%, #00FFE6 100%);
    background-image: -moz-linear-gradient(bottom, #2E9185 0%, #00FFE6 100%);
    background-image: -webkit-linear-gradient(bottom, #2E9185 0%, #00FFE6 100%);
    background-image: -ms-linear-gradient(bottom, #2E9185 0%, #00FFE6 100%);
    background-image: linear-gradient(to bottom, #2E9185 0%, #00FFE6 100%);
}

现在这看起来工作正常