使用jQueryUI时设置单选按钮的宽度

Geo*_*aly 4 jquery-ui width jquery-ui-button

我正在使用jQuery UI单选按钮,并且无法找到如何将它们全部设置为固定宽度.

我正在使用的代码是:

<script type="text/javascript">
    $(document).ready(function () {
        $("#radio").buttonset();
    });
</script>

<div id="radio">
    <input type="radio" id="radio1" name="radio" /><label for="radio1">A</label>
    <input type="radio" id="radio2" name="radio" checked="checked" /><label for="radio2">Choice 2 - long long</label>
    <input type="radio" id="radio3" name="radio" /><label for="radio3">Choice 3</label>
</div>
Run Code Online (Sandbox Code Playgroud)

我是第一次使用jQuery,并且没有CSS或javascript经验.我已经尝试了各种奇怪的组合来尝试为按钮指定一个固定的宽度而不会丢失jQuery UI样式,但是没有运气.

任何帮助,将不胜感激.

Nic*_*ver 10

您可以<label>使用.width(val)如下设置显示的元素的宽度:

$("#radio").buttonset().find('label').width(200);
Run Code Online (Sandbox Code Playgroud)

你可以在这里尝试一下,或者你可以像这样添加一个CSS规则:

?#radio label { width: 200px }?
Run Code Online (Sandbox Code Playgroud)

你可以试试这里.