twitter-bootstrap – 引导窗体组间距

我想在控件之间有一些间距.根据规范,应该使用表单组来实现.但是在我的情况下不行.

http://jsfiddle.net/TLF4L/

<div class="col-xs-12 col-sm-12">
    <form role="form">
        <div class="form-group">
            <div class="col-xs-3 text-right">
            <label for="cpTitle">Title</label>
            </div>
            <div class="col-xs-9">
                <input type="text" class="form-control" placeholder="Title of the program" id="cpTitle" />
            </div>
        </div>
        <div class="form-group">
            <div class="col-xs-3 text-right">
            <label for="cpDesc">Description</label>
            </div>
            <div class="col-xs-9">
                <textarea class="form-control" rows="3" placeholder="Description of the program" id="cpDesc"></textarea>
            </div>
        </div>
        <div class="form-group">
            <div class="col-xs-3 text-right">
                <label for="cpAddr">Program address</label>
            </div>
            <div class="col-xs-9">
                <input type="text" class="form-control" placeholder="Name of Facility" id="cpAddr" />
                <input type="text" class="form-control" placeholder="Street 1" />
                <input type="text" class="form-control" placeholder="Street 2" />
                <div class="col-xs-4">
                    <input type="text" class="form-control" placeholder="State" />
                </div>
                <div class="col-xs-4">
                    <input type="text" class="form-control" placeholder="City" />
                </div>
                <div class="col-xs-4">
                    <input type="text" class="form-control" placeholder="Zip" />
                </div>
            </div>
        </div>
    </form>
</div>
http://jsfiddle.net/TLF4L/6/

主要的问题是确保您在表单上设置类“form-horizo​​ntal”.对于程序地址字段,您可以为每个地址分配一行,或者我建议的只是在每个输入字段上添加一个用于margin-bottom的CSS.上面编辑了jsfiddle

.margin-bottom {
margin-bottom:15px;}



<div class="col-xs-12 col-sm-12">
<form role="form" class='form-horizontal'>
    <div class="form-group">
        <div class="col-xs-3 text-right">
            <label for="cpTitle">Title</label>
        </div>
        <div class="col-xs-9">
            <input type="text" class="form-control" placeholder="Title of the program" id="cpTitle" />
        </div>
    </div>
    <div class="form-group">
        <div class="col-xs-3 text-right">
            <label for="cpDesc">Description</label>
        </div>
        <div class="col-xs-9">
            <textarea class="form-control" rows="3" placeholder="Description of the program" id="cpDesc"></textarea>
        </div>
    </div>
    <div class="form-group">
        <div class="col-xs-3 text-right">
            <label for="cpAddr">Program address</label>
        </div>
        <div class="col-xs-9">
            <input type="text" class="form-control margin-bottom" placeholder="Name of Facility" id="cpAddr" />
            <input type="text" class="form-control margin-bottom" placeholder="Street 1" />
            <input type="text" class="form-control margin-bottom" placeholder="Street 2" />
        </div>
    </div>
    <div class="form-group">
        <div class="col-xs-3 text-right">&nbsp;</div>
        <div class="col-xs-3">
            <input type="text" class="form-control" placeholder="State" />
        </div>
        <div class="col-xs-3">
            <input type="text" class="form-control" placeholder="City" />
        </div>
        <div class="col-xs-3">
            <input type="text" class="form-control" placeholder="Zip" />
        </div>
    </div>
</form>
相关文章
相关标签/搜索