سؤال

I would like to have some spacing between the controls. According to spec, it should be achieved using form-group class. However it is not working in my case.

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/

Main issue is to make sure you set class "form-horizontal" on your form. For the program address fields, you could either set out a separate row for each or what I'd suggest is just adding a css for margin-bottom on each input field. Edited jsfiddle above

.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>

نصائح أخرى

I updated your fiddle, added a textarea class as well. Updated fiddle

You need to use CSS to set a margin bottom to your input fields

input[type=text], .txtarea{
margin-bottom: 10px;

 }
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top