Pseudo-class for clicking a button on Mobile WebKit

Currently, I am in the process of developing a private framework to replicate the iOS UI using CSS 3 and HTML 5. Most of the widgets have been created, including various colored gradient buttons, but faced with challenges when attempting to incorporate a blue gradient for a button click.

I experimented with different examples such as button:focus, button:active, button:hover without success. When clicking the button in Mobile WebKit, it consistently displays the default grey box. Any assistance or guidance would be greatly appreciated.

My goal is to achieve the following effect:

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

I also attempted to apply the class to the button upon 'click' using jQuery, but encountered the same outcome. So, my question remains - what is the correct pseudo-class name for when a user taps an element in Mobile WebKit?

Answer №1

Our solution is successful...

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

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What could be the reason behind the improper display of JavaScript for ID overlay2?

Why is it that when I try to have two overlays with different messages display upon clicking buttons, they both end up showing the same message? Even after changing the ID tag names, the issue persists. Can someone shed some light on what might be causin ...

What is the best way to smoothly scroll to another page using a specific id?

My website consists of multiple pages and I am looking for a code that will allow for smooth scrolling navigation to another page when loading on a specific id or section. For example, in the navbar I have multiple pages with links. When clicking on a lin ...

ETags for webpages generated on the server-side and equipped with a CSP nonce

I have successfully implemented ETags in my server-side-rendered React app using Node/Express, allowing for client-side caching. The HTML is generated with inlined fragments of render-blocking CSS and JS for faster first renders according to Google's ...

Using Swift 3 to Access Google Maps API Directions

Having recently started using Swift 3, I've encountered an issue with creating a route using the Google Maps API directions. In my route, there are multiple waypoints and in Swift 3, the URL: https://maps.googleapis.com/maps/api/directions/json?orig ...

Problem with IE off-canvas scrolling

Currently, I am facing an issue with the scrolling functionality of an off-canvas sidebar on my Joomla 3 website. It seems to be working fine in Chrome and Firefox, but when it comes to Internet Explorer, the visible scroll bar refuses to move when attempt ...

Order the Javascript array based on the frequency of each element's occurrence

Seeking assistance with Jquery sorting based on the number of occurrences in an array as I am new to Jquery and Javascript. Numerous sorting methods have been attempted without success. The current array in Javascript is allTypesArray = ["4", "4","2", "2 ...

Adjust the sidebar size in Bootstrap 5 to align perfectly with the navbar brand

https://i.stack.imgur.com/Ra0c7.png I'm trying to ensure that the width of the sidebar on this page aligns consistently with the end of the logo in the top right. However, using variations of col-xxl-1 etc. is causing inconsistent sizes at different ...

Tips for creating a mobile-friendly contact section on your website

I have encountered an issue with my Contact Us page. Although it works perfectly on desktop, the mobile view is not responsive. Is there anyone who can assist me in resolving this error? Here is the Contact Us page that needs to function properly on mobil ...

Accessing table cell value when clicked using JavaScript or jQuery

I am currently working on an ASP.NET MVC application where I have a table displaying records from the database in razor code. My goal is to extract the record ID "FeeZoneID" from a cell value when the delete link in the last column is clicked, and then t ...

What is the best way to incorporate multiple versions of jQuery on one webpage?

Is it possible to use multiple versions of jQuery on a single page? I need two different versions for various functions, but they seem to be conflicting with each other. If I implement jQuery noconflict, will the product scripts still work? <script typ ...

Set the <img> source to link to a PHP webpage

I store all my images in a secure directory inaccessible to normal users. The filenames are generated randomly, so I want to keep the path and names of the files hidden. Currently, my img element looks like this: <img src="get_image.php?id=1"> This ...

The Font Awesome icons are failing to load properly and are displaying as square boxes in HTML

After cloning the website from HTTRACTs, I noticed a problem with the icons such as Facebook and Instagram appearing as squares on the entire pages. Upon inspecting the elements, I found that the error log was showing Failed to load resource: net::ERR_FILE ...

What is the reason for the attribute align="center" functioning in my HTML document?

Recently, I decided to delve into the world of HTML and created a simple basic file: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> My Webpage </title </head> ...

Reduce the dimensions of a CSS attribute automatically

Displayed below is the image with a width of 192 and height of 109: <a href="https://www.blogger.com/u/1/blogger.g?blogID=4402911157743442948#"><img alt="" class="thumbnail" height="109" src="https://2.bp.blogspot.com/-E5ftfbCCgkw/XjnLpO347cI/AAA ...

Obtain data without issuing a new query in flexigrid

I am encountering an issue with flexigrid where the initial page load triggers a query, and then when I either (1) adjust the sort order or (2) navigate to the next page, it runs a new query with different parameters, resulting in slow performance. I am s ...

Struggling with Ajax and Javascript. Continuously looping through prior requests

I've got this neat Ajax code that loads in PHP content. When you click on a left-hand navigation menu item, it reloads a Div with the appropriate content. The issue is that it loops through previous requests, which can be annoying (Try clicking on an ...

Unable to retrieve user email from FBLoginView

After implementing the following code block: - (void) viewDidLoad { [_fbLoginView setReadPermissions:@[@"public_profile", @"email"]]; [_fbLoginView setDelegate:self]; } - (void)loginViewFetchedUserInfo:(FBLoginView *)loginView ...

Jquery's mouseclick event selects an excessive number of elements

Is there a way to retrieve the ID of an element when it is clicked, only if it has one? I currently have this code set up to alert me with the element's ID: $("[id]").click(function(event) { event.preventDefault(); var id_name = $(this).attr ...

Getting the user's language in PhoneGap can be done in a variety of ways

I attempted to retrieve the language value of the device using the globalization plugin. I followed all installation procedures, read through the documentation, and searched for answers on this platform, but unfortunately, none of them provided the solutio ...

jQuery id selector issue: not selecting elements properly

It seems like I am overlooking a very fundamental aspect here. Essentially, there are 2 div elements in the HTML markup. When one is clicked (#x), the other div element (#block1) gains a new class (.change), resulting in a change in its color. The issue ...