jquery - 水平选择全宽 jQuery Mobile

标签 jquery html css jquery-mobile

我试图询问用户的生日,但遇到了一些文体问题。

你应该能从这个http://jsfiddle.net/DjsWv/14/中理解我的问题

我开始于:

         <fieldset data-role="controlgroup" data-type="horizontal">
            <legend>Date of Birth:</legend>
            <select name="select-choice-month" id="select-choice-month" data-icon="false">
                <option >Month</option>
                <option value="jan">Jan</option>
            </select>
            <select name="select-choice-day" id="select-choice-day" data-icon="false">
                <option >Day</option>
                <option value="1">1</option>
            </select>
            <select name="select-choice-year" id="select-choice-year">
                <option >Year</option>
                <option value="2011">2012</option>
            </select>
        </fieldset>

这里的问题是我不喜欢宽度未满或 100%

我看到的唯一解决方案是使用导航栏,它看起来让我不舒服......关于如何让这个水平控制组显示为完整/标准宽度的任何想法

最佳答案

工作示例:http://jsfiddle.net/Gajotres/PUVkw/

HTML

<fieldset data-role="controlgroup" data-type="horizontal" class="custom-fieldset">
    <legend>Date of Birth:</legend>

    <select name="select-choice-month" id="select-choice-month" data-icon="false">
        <option >Month</option>
        <option value="jan">Jan</option>
    </select>

    <select name="select-choice-day" id="select-choice-day" data-icon="false">
        <option >Day</option>
        <option value="1">1</option>
    </select>

    <select name="select-choice-year" id="select-choice-year">
        <option >Year</option>
        <option value="2011">2012</option>
    </select>
</fieldset>

CSS

.custom-fieldset .ui-controlgroup-controls {
    width: 100% !important;
}

.custom-fieldset .ui-controlgroup-controls .ui-select {
    width: 33.33% !important;
}

不要忘记将自定义类名添加到您的字段集中,在我的例子中它被称为:custom-fieldset

编辑

正在关注 ericjbasti 评论这是一个带有自定义 id 且没有 !important 的解决方案:http://jsfiddle.net/Gajotres/PUVkw/1/

关于jquery - 水平选择全宽 jQuery Mobile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17861017/

相关文章:

javascript - 带有文本输入选项的 JS 交互式测验

java - Android 中的 HTML 解析

css - Primefaces 日历位置

css - Google Chrome 开发者工具不显示检查的元素样式?

javascript - Chosen 没有正确设置我的选择下拉列表的样式

javascript - 单击按钮时调用脚本

javascript - Vimeo Froogaloop - 未检测到暂停

javascript - 如何动态设置填充并在不刷新的情况下显示?

jquery - 具有多个条件的 If 语句出现故障

javascript - 弹出窗体 - 定位和样式