twitter bootstrap form-control如何内联

时间:2014-09-10 02:44:31

标签: twitter-bootstrap

我如何制作" 2014"和" SS"表格控制是" col-md-6",形成没有类,它看起来像

<div class="row">
    <div class="col-md-6">
        <div class="form-group">
            <label for="year">年份*</label>
            <div class="col-md-6">
            <div id="year" class="input-group date">
                <input id="yearVal" name="year" type="text" class="form-control" readonly/><span
                    class="input-group-addon"><i class="fa fa-calendar"></i></span>
            </div>
            </div>
            <div class="col-md-6">
            <select id="season" name="season" class="form-control">
                <option value="false">SS</option>
                <option value="true">FW</option>
            </select>
            </div>
        </div>
    </div>
</div>

my page

2 个答案:

答案 0 :(得分:0)

我刚刚为季节添加了标签空间。

<div class="row">
    <div class="col-md-6">
        <div class="form-group">

            <div class="col-md-3">
            <label for="year">年份*</label>
              <div id="year" class="input-group date">
                <input id="yearVal" name="year" type="text" class="form-control" readonly=""><span class="input-group-addon"><i class="fa fa-calendar"></i></span>
            </div>
            </div>
            <div class="col-md-3">
              <label for="season">&nbsp;</label>
            <select id="season" name="season" class="form-control">
                <option value="false">SS</option>
                <option value="true">FW</option>
            </select>
            </div>
        </div>
    </div>
</div>

查看此bootply中的输出 希望这有帮助!

答案 1 :(得分:0)

试试这个:

只需使用col-md-12作为标签:

<div class="col-md-12">
       <label for="year">年份*</label>
</div>

DEMO

完整的HTML:

<div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <div class="col-md-12">
                        <label for="year">年份*</label>
                    </div>
                    <div class="col-md-6">
                        <div id="year" class="input-group date">
                            <input id="yearVal" name="year" type="text" class="form-control" readonly /><span
                                class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <select id="season" name="season" class="form-control">
                            <option value="false">SS</option>
                            <option value="true">FW</option>
                        </select>
                    </div>
                </div>
            </div>
        </div>