【问题标题】:Stop jQuery Mobile Horizontal Radio Buttons from Breaking or Wrapping阻止 jQuery Mobile 水平单选按钮断开或换行
【发布时间】:2022-01-22 22:01:57
【问题描述】:

我正在尝试使用 jQuery Mobile 演示页面中的 html 并排创建两个水平单选按钮组。
问题是当单选按钮之间仍有足够的空间时,它们会中断并开始换行到下一行。有没有办法让它们在小屏幕上几乎没有空间之前不换行?

你可以在this fiddle.看到发生了什么

另外,我想将第二个无线电分组向右对齐,但将text-align:rightposition:relative; right:0px 添加到#SecondGroup 没有任何效果。

这是我的代码:

             <div data-role="fieldcontain">
                    <fieldset  class="ui-grid-a ">

                        <div class="ui-block-a" id="FirstGroup">
                            <fieldset data-role="controlgroup" data-mini="true" data-theme="b" data-type="horizontal" >
                                <input type="radio" name="same" id="sold" value="on" checked="checked">
                                <label for="sold">One</label>
                                <input type="radio" name="same" id="active" value="off">
                                <label for="active">Two</label>
                            </fieldset>
                        </div>                      

                        <div class="ui-block-b" id="SecondGroup">
                            <fieldset data-role="controlgroup" data-mini="true" data-theme="b" data-type="horizontal" >
                                <input type="radio" name="conditionSame" id="all" value="on" checked="checked">
                                <label for="all">One</label>
                                <input type="radio" name="conditionSame" id="used" value="on" >
                                <label for="used">Two</label>
                                <input type="radio" name="conditionSame" id="new" value="on">
                                <label for="new">Three</label>
                            </fieldset>

                        </div>                          

                    </fieldset>
                </div>

谢谢。

【问题讨论】:

    标签: jquery html css jquery-mobile responsive-design


    【解决方案1】:

    您的代码中有不可见的空格 &amp;nbsp;(请参见下面的屏幕截图)。去除它们后,包装工作。

    小提琴:http://jsfiddle.net/bunoxL4r/3/

    在您的小提琴源代码截图中,您可以看到这些&amp;nbsp;

    【讨论】:

    • 成功了,非常感谢!你知道空白是怎么来的吗?
    • :-) 最终复制和粘贴?
    【解决方案2】:

    我遇到了同样的问题 - 查看源代码,我发现了类似的非中断空格集; 我的代码中没有,所以他们是如何到达那里的? 我使用制表符缩进了代码(现在使用空格!)。不知何故,制表符被转换为不间断的空格。去掉所有的缩进就解决了问题。

    【讨论】:

      猜你喜欢
      • 2013-01-14
      • 1970-01-01
      • 2013-01-16
      • 2013-08-28
      • 1970-01-01
      • 1970-01-01
      • 2011-04-29
      • 2018-05-29
      • 1970-01-01
      相关资源
      最近更新 更多