2011-08-17 87 views
0

我目前正在研究一个私人框架来模仿CSS 3和HTML 5中的iOS UI。我创建了大部分小部件,包括众多彩色渐变按钮,但我遇到了困难在蓝色渐变中添加一个按钮被点击。移动WebKit按钮点击虚拟类

我试过以下例子:button:focus,button:active,button:hover但似乎没有任何工作。当点击Mobile 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中的元素时调用的正确的伪类是什么?

回答

1

这为我们工作?

.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;}