0

I am using jQuery mobile in my sample project. I have three buttons. I am changing the style of the buttons (adding my own CSS) so that it overrides jQuery button CSS. But while adding it still shows some small white background. I inspect the page and find it is jQuery mobile button. I am not able to override that background. Here is my attempt: 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; 
}

Using the DOM inspector, when I removed this background: 2b6dbc it will show jQuery mobile button.

How can I remove that?

After adding this, it changing the color on 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;}
5
  • Looks like your .ui-btn-inner's width is wider than the .ui-btn... Commented Aug 9, 2013 at 9:50
  • how to change that..? Commented Aug 9, 2013 at 9:53
  • I added a response below. You are changing the with of the inner, but you forgot to change the width of the button itself. Commented Aug 9, 2013 at 9:55
  • this is what you want? jsfiddle.net/Palestinian/5DDBD/6 Commented Aug 9, 2013 at 9:55
  • yes omar got it nice answer Commented Aug 9, 2013 at 9:59

5 Answers 5

1

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

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

.ui-btn-inner {
    color:#FFFFFF;
}
Sign up to request clarification or add additional context in comments.

1 Comment

note that will change all elements with ui-btn and ui-btn-inner. Its advisable to identify them by a custom class i.e. .ui-custom .ui-btn
0

The CSS are inheriting from ".ui-btn-up-c" class. It is defined in your "c" theme (data-theme = c).

So the best way to define your own "c" theme in Theme Roller jquery Mobile. http://jqueryui.com/themeroller/

Or you can change the background from ".ui-btn-up-c".

1 Comment

can you do some change on my fiddle for better understand
0

Add your custom css to .ui-btn instead of .ui-btn-inner

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

See here.. http://jsfiddle.net/5DDBD/2/

1 Comment

but previous button is not looking good..!! if the width of all buttons same it look good..?
0

".ui-grid-c > :nth-child(n)" on jquery.mobile-1.3.0-beta.1.css, you can fixed it:

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

and ".ui-grid-c .ui-btn-inner" remove margin-left:4px property.

1 Comment

can you change on my fiddle?
0

You need to remove the width and margin-left properties from .ui-grid-c .ui-btn-inner.

1 Comment

Sorry I think I misunderstood your question. I thought you just wanted to remove the white space around the button. I can see you already found the answer so no need to modify mine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.