css – 自定义输入[type =“submit”]样式不能使用jquerymobile按钮

前端之家收集整理的这篇文章主要介绍了css – 自定义输入[type =“submit”]样式不能使用jquerymobile按钮前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想在jquerymobiles按钮输入[type =“submit”]按钮时使用我的自定义样式,但它不工作.
我的HTML代码是:
  1. <input type="submit" value="Button name">

我的css代码是:

  1. input[type="submit"]
  2. {
  3. border:1px solid red;
  4. text-decoration:none;
  5. font-family:helvetica;
  6. color:red;
  7. background:url(../images/btn_hover.png) repeat-x;
  8. }

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

  1. <a href="#" class="selected_btn" data-role="button">Button name</a>

解决方法

jQuery Mobile> = 1.4

创建一个自定义类,例如.custom-BTN.请注意,为了覆盖jQM样式而不使用!重要,应该尊重CSS层次结构. .ui-btn.custom-class或.ui-input-btn.custom-class.

  1. .ui-input-btn.custom-btn {
  2. border:1px solid red;
  3. text-decoration:none;
  4. font-family:helvetica;
  5. color:red;
  6. background:url(img.png) repeat-x;
  7. }

添加一个数据包装类进行输入.自定义类将被添加到输入包装div.

  1. <input type="button" data-wrapper-class="custom-btn">

07000

jQuery Mobile< = 1.3 输入按钮由带有ui-btn类的DIV包装.您需要选择该div和输入[type =“submit”].使用!important对于覆盖Jquery Mobile样式至关重要.

07001

  1. div.ui-btn,input[type="submit"] {
  2. border:1px solid red !important;
  3. text-decoration:none !important;
  4. font-family:helvetica !important;
  5. color:red !important;
  6. background:url(../images/btn_hover.png) repeat-x !important;
  7. }

猜你在找的CSS相关文章