移动WebKit按钮点击伪类



我目前正在开发一个私有框架来模仿CSS 3和HTML 5中的iOS UI。我已经创建了大多数小部件,包括许多彩色渐变按钮,但是我在添加蓝色渐变按钮时遇到了困难。

我尝试了以下示例:button:focus, button:active, button:hover,但似乎没有任何工作。当我在移动WebKit中单击按钮时,我所呈现的是默认的灰色框。不知道有没有人能给我指个正确的方向。

基本上,我想这样做:

div.inner button:active {
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(173,182,211,1)), color-stop(1%,rgba(143,155,205,1)), color-stop(50%,rgba(48,74,184,1)), color-stop(51%,rgba(22,49,164,1)), color-stop(100%,rgba(41,89,165,1)));
    background: -webkit-linear-gradient(top, rgba(173,182,211,1) 0%,rgba(143,155,205,1) 1%,rgba(48,74,184,1) 50%,rgba(22,49,164,1) 51%,rgba(41,89,165,1) 100%);
    color: #fff;
    text-shadow: 0 -1px 1px rgba(0,0,0,0.8);
    outline: none;
    -webkit-appearance: none;
}

希望这是有意义的!我甚至尝试在使用jQuery"点击"按钮时将类添加到按钮,但再次没有发生任何事情。我想我的问题是,当用户点击移动WebKit中的元素时,正确的伪类是什么?

这对我们有用…

.button {width: 100%; font-family: Arial; font-size: 12pt; font-weight: bold; color: #ffffff; padding: 10px 20px; margin-bottom: 8px;
            background: -moz-linear-gradient(top, #a3a3a3 0%, #5b5b5b 30%, #444444 50%, #222222);
            background: -webkit-gradient(linear, left top, left bottom, from(#a3a3a3), color-stop(0.30, #5b5b5b), color-stop(0.50, #444444), to(#222222));
            border-radius: 10px;
            -moz-border-radius: 10px;
            -webkit-border-radius: 10px;
            border: 1px solid #333333;
            -moz-box-shadow: 0px 1px 3px rgba(000,000,000,0.5), inset 0px 0px 1px rgba(255,255,255,0.6);
            -webkit-box-shadow: 0px 1px 3px rgba(000,000,000,0.5), inset 0px 0px 1px rgba(255,255,255,0.6);
            text-shadow: 0px -1px 0px rgba(000,000,000,1), 0px 1px 0px rgba(255,255,255,0.2);}
.button:active {
            background: -moz-linear-gradient(top, #838383 0%, #3b3b3b 30%, #242424 50%, #000000);
            background: -webkit-gradient(linear, left top, left bottom, from(#838383), color-stop(0.30, #3b3b3b), color-stop(0.50, #242424), to(#000000));
            border: 1px solid #000000;
            box-shadow:none;
            -moz-box-shadow:none;
            -webkit-box-shadow:none;
            text-shadow: none;}

最新更新