我将此JQuery用于图形单选按钮集,但想知道如何更改按钮的背景颜色?


我想知道如何更改所有背景(标准,悬停,选中)
我想知道如何更改按钮集的框大小。


谁能告诉我?

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>jQuery UI Button - Radios</title>
    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.3/themes/smoothness/jquery-ui.css">
    <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <script src="//code.jquery.com/ui/1.11.3/jquery-ui.js"></script>

    <script>
      $(function() {
        $("#radio").buttonset();
      });
    </script>
  </head>
  <body>
    <form>
      <div id="radio">
        <input type="radio" id="radio1" name="radio">
        <label for="radio1"><img src="image1.gif" /></label>
        <input type="radio" id="radio2" name="radio" checked="checked">
        <label for="radio2"><img src="image2.gif" /></label>
        <input type="radio" id="radio3" name="radio">
        <label for="radio3"><img src="image3.gif" /></label>
      </div>
    </form>
  </body>
</html>

最佳答案

浏览器的F12工具中的DOM Explorer是您的朋友。
如果您使用的是标准jQueryUI,则通过制作新控件来代替它们,从而将输入生成为buttonsetbuttonset的背景颜色实际上是新label的背景,其css来自jquery-ui.css(或jquery-ui.min.css),并且影响背景颜色的应用类通常是


.ui-state-default
.ui-widget-content
.ui-widget-header


通过在DOM-explorer中选择控件,您可以看到应用了哪些类,以及它们来自哪个.css文件。悬停或选择时也适用。只需打开.css,ctrl + f即可找到正确的类并更改值。
去寻找和调整。

关于jquery - 如何更改jQuery图形单选按钮的背景颜色和Box大小?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34331897/

10-12 00:02
查看更多