自定义输入[type ="submit"]样式不适用于jquerymobile按钮

Pra*_*sad 18 css html5 jquery-mobile

我想使用jquerymobiles按钮在输入[type ="submit"]按钮上使用我的自定义样式,但它不起作用.我的HTML代码是:

<input type="submit"  value="Button name">
Run Code Online (Sandbox Code Playgroud)

我的css代码是:

input[type="submit"]
{
    border:1px solid red;
    text-decoration:none;
    font-family:helvetica;
    color:red;
    background:url(../images/btn_hover.png) repeat-x;
}
Run Code Online (Sandbox Code Playgroud)

当我使用以下html代码时,相同的样式适用:

<a href="#" class="selected_btn" data-role="button">Button name</a>
Run Code Online (Sandbox Code Playgroud)

Oma*_*mar 22

jQuery Mobile> = 1.4

创建一个自定义类,例如.custom-btn.请注意,要在不使用的情况下覆盖jQM样式!important,应遵循CSS层次结构..ui-btn.custom-class.ui-input-btn.custom-class.

.ui-input-btn.custom-btn {
   border:1px solid red;
   text-decoration:none;
   font-family:helvetica;
   color:red;
   background:url(img.png) repeat-x;
}
Run Code Online (Sandbox Code Playgroud)

添加data-wrapper-classinput.自定义类将添加到input包装div.

<input type="button" data-wrapper-class="custom-btn">
Run Code Online (Sandbox Code Playgroud)

演示


jQuery Mobile <= 1.3

Input按钮由DIV包含在类中ui-btn.你需要选择那个div和input[type="submit"].使用!important对于覆盖Jquery Mobile样式至关重要.

演示

div.ui-btn, input[type="submit"] {
 border:1px solid red !important;
 text-decoration:none !important;
 font-family:helvetica !important;
 color:red !important;
 background:url(../images/btn_hover.png) repeat-x !important;
}
Run Code Online (Sandbox Code Playgroud)