I am currently working on a private framework to mimic the iOS UI in CSS 3 and HTML 5. I have created most of the widgets, including the numerous coloured gradient buttons, but I am having difficulty adding in the blue gradient a button is clicked.
I have tried the following examples: button:focus
, button:active
, button:hover
but nothing seems to work. All I am presented with is the default grey box when clicking the button in Mobile WebKit. I wonder if anyone can point me in the right direction.
Essentially, I want to do this:
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;
}
Hope that makes sense! I even tried adding the class to the button when it was 'clicked' using jQuery but again nothing happens. I suppose my question is, what is the correct pseudo-class called when a user taps an element in Mobile WebKit?
This works for us...
.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;}