我在我的 jquery 移动应用程序中使用了单选按钮,我使用的是 jquery 移动 1.0 和 jquery 1.6.4。问题是它总是左对齐。所以,我试图在中心移动,但它不起作用。如何解决这个问题?提前致谢。
<div id="userOptionGroup" data-role="contain">
<fieldset data-role="controlgroup" data-type="horizontal" data-theme="b" style="font-size:12px;border:2px;">
<input type="radio" data-theme="b" name="radio-choice-b" id="radio-choice-wuser" value="windowUser" checked="checked" />
<label for="radio-choice-wuser" style="font-size: 12px;" class="ui-btn-section-active" id="lblWindowUser">win user</label>
<input type="radio" data-theme="b" name="radio-choice-b" id="radio-choice-muser" value="mfileUser" />
<label for="radio-choice-muser" style="font-size: 12px;" id="lblMfileUser">M file user</label>
</fieldset>
</div>
最佳答案
您必须将单选按钮包装在具有固定宽度的 div 中,并且在字段集上将边距设置为自动。方法如下 - 当然不使用内联 css 更整洁。
<fieldset data-role="controlgroup" data-type="horizontal" style="text-align: center">
<div style="width: 200px; margin: 0 auto;">
<input type="radio" name="radio-choice-1" id="radio-choice-1" value="choice-1" checked="checked" />
<label for="radio-choice-1">A</label>
<input data-theme="e" type="radio" name="radio-choice-1" id="radio-choice-2" value="choice-2" />
<label for="radio-choice-2">B</label>
</div>
</fieldset>
关于jquery - 单选按钮在 jquery 移动版本 1.0 中没有正确对齐中心?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8252895/