What is the best way to eliminate the color of a jquery mobile button or customize the button's

In my current project, I am utilizing jQuery mobile and have included three buttons. To customize the style of these buttons and override the default jQuery button CSS, I applied my own CSS. However, I encountered an issue where a small white background was still visible despite my attempts to change it. Upon inspecting the page, I discovered that this background belonged to the jQuery mobile button, making it difficult for me to override. Here is the code snippet I tried: http://jsfiddle.net/naveennsit/5DDBD/

.ui-grid-c .ui-btn-inner {
    background: #2b6dbc; 
    color: #FFFFFF; 
    border: 1px solid #000; 
    border-radius: 3px; 
    width: 100px; 
    text-shadow: none; 
    margin-left: 4px; 
}

Upon using the DOM inspector, removing the line background: #2b6dbc revealed the underlying jQuery mobile button.

Any suggestions on how I can successfully remove this unwanted background?

Additionally, after applying the above styles, there seems to be an issue with color changes upon focus and unfocus.

.ui-btn-up-c{background:#2b6dbc; color:#FFFFFF; border:1px solid #000; border-radius:3px; width:100px; text-shadow:none; margin-left:4px;}

Answer №1

Customize the ui-btn element directly: http://jsfiddle.net/5DDBD/5/

.ui-btn {
    background: #2B6DBC;
    text-shadow: none;
}

.ui-btn-inner {
    color:#FFFFFF;
}

Answer №2

The CSS properties are being inherited from the ".ui-btn-up-c" class, which is specifically defined in your "c" theme (data-theme = c).

To create your own customized "c" theme in Theme Roller for jQuery Mobile, visit http://jqueryui.com/themeroller/

Alternatively, you have the option to modify the background settings of the ".ui-btn-up-c" class.

Answer №3

Instead of applying custom css to .ui-btn-inner, try adding it to .ui-btn

.ui-grid-c .ui-btn
{
background:#2b6dbc; 
color:#FFFFFF; 
border:1px solid #000; 
border-radius:3px; 
width:100px; 
text-shadow:none;
margin-left:4px; 
}

Check out this link for an example: http://jsfiddle.net/5DDBD/2/

Answer №4

When dealing with the issue of ".ui-grid-c > :nth-child(n)" in jquery.mobile-1.3.0-beta.1.css, a solution can be implemented:

.ui-grid-c > :nth-child(n){
/* width: 25% */
margin-right:5px;
border:none;
}

Additionally, it is advisable to eliminate the margin-left:4px property from ".ui-grid-c .ui-btn-inner".

Answer №5

To fix the issue, it's recommended to delete the width and margin-left attributes from .ui-grid-c .ui-btn-inner.

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

Change the background color of a link using jQuery

Currently in the process of using jQuery to change the background color of a link when it's clicked. However, I would like to revert this color back to its original state once either a) the link is closed or b) another link is clicked (such as Dropdow ...

Leveraging JSON Data within the ASP.NET MVC Framework

Being new to this, I am in search of guidance. Currently, I have set up an ASP.NET MVC4 (beta) Mobile project and I am faced with the task of consuming a series of REST APIs. The data from these APIs is provided in JSON format. Could you please provide m ...

Analyzing comments on Facebook

My goal is to extract data from FB comments JSON by accessing data.id. var url = http://graph.facebook.com/comments?id={{ url_of_the_page }} Utilizing jQuery, I aim to retrieve data.id and other elements by: $j.getJSON(url, function (item) { ...

What is the best way to determine the size of CSS elements relative to other elements?

Is there a way to calculate the size of an element by using calc() or any other method based on the size of another DOM element? ...

Unable to scroll through embed code on iOS responsive devices

-webkit-overflow-scrolling: touch; overflow-y: scroll; I have attempted using this code but unfortunately it is still not functioning as expected. The issue seems to only occur on iOS responsive devices, as it works fine on other devices including MAC. ...

Utilize jQuery to load portions of a webpage.onreadystatechange with jQuery

Here is the issue I am facing with loading content using jQuery: <nav id="side-nav"> <ul> <li><a href="consulting">Consulting</a></li> etc.. My jQuery code snippet is as follows:</> $(document).ready(function() { ...

Generate a new web component using JavaScript

My HTML table looks like this: <table id = "rpttable" name = "rpttable"> <thead> Column Headers here... </thead> <tbody id = "rptbody" name = "rptbody"> data here <3 .... </tbody> </table> And in my ...

issue encountered when implementing slick.js in angular 6

Trying to implement slick.js, a carousel framework, in an Angular project. Initially attempted 'npm install slick --save' and manually adding the downloaded files to scripts and styles JSON objects. When that failed, resorted to importing the C ...

Unsuccessful CSS integration with Django webpage

I have created a navigation bar using HTML and CSS, but I am having trouble getting the CSS to affect the HTML. I have checked my static files setup and tried various settings, but nothing seems to work. Any assistance would be greatly appreciated. As a be ...

Using conditional CSS in React/Next.js

While using Next.js, I have implemented conditional rendering on components successfully. However, I am facing an issue where the CSS styles differ between different components. Code 1: import React from "react"; import Profile from "../../ ...

Is there a way to properly handle the loading of all images within a specific jQuery selection?

After running the code below, it is executed for each item in the selection: $('.someElement img').load( function() { // Do something }); Consequently, if .someElement has 5 images, it triggers 5 separate times. How can I set up an event so ...

Tips for displaying lower quality images while initially downloading higher quality versions

I need to download and display a large image in an img tag. Since the image is not Progressive JPEG, it will render as it downloads. Is there a way to show a low-resolution version of the image while it fetches from the server using only CSS or an HTML p ...

jQuery - issue with toggling class on label/input when clicking rapidly

I've encountered an unusual issue with my checkboxes. HTML: <div class="f-checkbox"> <label class="f-label" for="f-field"> Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iure cumque voluptatem nisi incidunt praese ...

Alter the background color based on the movement of the mouse

Is it possible to dynamically change the background color of elements on a webpage based on mouse coordinates? Current setup: I have a draggable DIV-A and several droppable divs on the page. What I am looking for: I want to highlight the droppable divs ...

Setting the maximum picture upload size limit to 2mb in Javascript is a simple task with the included script provided

On my website, there is a specific page where users can upload pictures. I want to restrict the size of the pictures being uploaded to a maximum of 2mb. Currently, the page allows images of all sizes to be uploaded. If an image exceeds 2mb, I want to displ ...

What is the best way to store text in a text area and retrieve it when the page is reloaded using jQuery or JavaScript

As a beginner in coding, I am in the process of creating a calendar on http://codepen.io/. I have included a textarea where I can input events for the month. When I click a button, the textarea data is saved to a variable. However, I am seeking a way to pe ...

Grayscale effect not displaying on hover in Internet Explorer 9

Seeking assistance with a mouseover state issue in IE9 that I am experiencing. Since this element will vary in size, I am unsure about using a background image sprite. The problem arises when hovering over the item, as the image turns grey. However, when ...

Using quotes, double, or single marks when sending parameters in a Jquery Ajax call

Is it possible to include quotes in the text being sent through an ajax call? I've encountered issues when users input quotes in a textarea. I want to preserve the quotes without removing them. This seems like a common issue, but there isn't much ...

Tips for utilizing a for loop within an array extracted from a jQuery element for automation

I am looking to streamline the process using a for loop for an array containing 10 image files in the parameters of initialPreview and initialPreviewConfig. My envisioned solution involves the following code snippet: for (i = 0; i < 11; i++) { "< ...

Display subcategories once a category has been chosen in Wordpress

I have a unique setup where I am using Wordpress categories to represent states and child-categories as cities. Currently, on the front-end of my website, I am displaying a dropdown menu using wp_dropdown_categories that only shows the states. My question ...