Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter bootstrap nesting form layouts

I am just getting started using bootstrap. I need to position three input fields to form an "address" field.

What I'm trying to achieve

I have tried using the following html:

<label for="street">Address</label>
<input class="span3" id="street" name="street" placeholder="Street"/><br/>

<input id="zipcode" class="span1 inline" placeholder="Zipcode"/>
<input id="city" class="span2 inline" placeholder="City"/>

This is almost correct but the size is a bit off

incorrect

Is there a better way to achieve this layout (without having to make custom styles to achieve the correct width)?

like image 336
Geoffrey De Vylder Avatar asked Jul 23 '26 14:07

Geoffrey De Vylder


1 Answers

Try using the following:

<div class="container">
<div class="row">
    <div class="span6 offset1">
        <form>
            <label for="street">Address</label>
            <div class="controls controls-row">
                <input type="text" class="span3" id="street" name="street" placeholder="Street"/>
            </div>
            <div class="controls controls-row">
                <input type="text" id="zipcode" class="span1" placeholder="Zipcode"/>
                <input type="text" id="city" class="span2" placeholder="City"/>
            </div>
        </form>
    </div>
</div>

​ Here is a fiddle

like image 142
Iurii.K Avatar answered Jul 25 '26 03:07

Iurii.K



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!