带引导程序的表单设计 - 对齐文本框和文本区域

时间:2016-03-02 03:31:34

标签: javascript jquery html css twitter-bootstrap

enter image description here

如上图所示,我想将文本框向上移动以与TextArea对齐。我可以申请任何Bootstrap课吗?我使用的是boostrap 3.3.6

HTML  

                <div class="panel-body">
                    <div class="col-md-12 col-sm-12">
                        <div class="row top-buffer">
                            <div class="col-md-2">
                                Quote Date:
                            </div>
                            <div class="col-md-2">
                                <asp:TextBox ID="txtReference" class="form-control" runat="server" ></asp:TextBox>
                            </div>
                            <div class="col-md-2">
                                Quote Prepared By:
                            </div>
                            <div class="col-md-2">
                                <asp:TextBox ID="txtCountry" class="form-control" runat="server"></asp:TextBox>
                            </div>
                        </div>

                         <div class="row top-buffer">
                            <div class="col-md-2">
                                Reseller:
                            </div>
                            <div class="col-md-2">
                                <asp:TextBox ID="TextBox1" class="form-control" runat="server" ></asp:TextBox>
                            </div>
                          <div class="col-md-2">
                                Notes:
                            </div>
                            <div class="col-md-2">
                                <asp:TextBox ID="TextBox2" class="form-control" runat="server" TextMode="MultiLine" Height="252px" Width="414px"></asp:TextBox>
                            </div>


                        </div>

                        <div class="row top-buffer">
                            <div class="col-md-2">
                                Reseller Contact:
                            </div>
                            <div class="col-md-2">
                                <asp:TextBox ID="TextBox3" class="form-control" runat="server" ></asp:TextBox>
                            </div>

                        </div>

                    </div>
                </div>
            </div>

1 个答案:

答案 0 :(得分:1)

这就是您想要的,更清洁,更灵敏的设计。您的目标是使用col-md-6列,因为您要将内容拆分为两列:

调整浏览器大小并查看结果: https://jsfiddle.net/L4LtoLsz/

<div class="panel-body">
<form class="form-horizontal">

    <div class="col-md-6">
        <div class="row top-buffer">

            <div class="form-group">
                <label for="inputEmail1" class="col-sm-3 control-label">Quote Date:</label>
                <div class="col-sm-9">
                    <input type="email" class="form-control" id="inputEmail1" placeholder="Quote Date">
                </div>
            </div>

            <div class="form-group">
                <label for="inputEmail2" class="col-sm-3 control-label">Reseller</label>
                <div class="col-sm-9">
                    <input type="email" class="form-control" id="inputEmail2" placeholder="Reseller">
                </div>
            </div>

            <div class="form-group">
                <label for="inputEmail3" class="col-sm-3 control-label">Reseller Contact:</label>
                <div class="col-sm-9">
                    <input type="email" class="form-control" id="inputEmail3" placeholder="Reseller Contact">
                </div>
            </div>
          </div>
       </div>


    <div class="col-md-6">
        <div class="row top-buffer">

            <div class="form-group">
                <label for="inputEmail5" class="col-sm-3 control-label">Quote Prepared By:</label>
                <div class="col-sm-9">
                    <input type="email" class="form-control" id="inputEmail5" placeholder="Quote Prepared By">
                </div>
            </div>

            <div class="form-group">
                <label for="tarea" class="col-sm-3 control-label">Notes:</label>
                <div class="col-sm-9">
                    <textarea id="tarea" class="form-control"></textarea>
                </div>
            </div>

        </div>
    </div>

    </form>