css - 使用水平形式对齐 Bootstrap 文本框

标签 css asp.net asp.net-mvc twitter-bootstrap-3

我正在处理一个包含多个输入字段的长表单,我试图对齐一个水平表单。 第一行有 3 个字段 (col-md-4),第二行有两个字段 (col-md-8 和 col-md-4)。如何让文本框右对齐?

enter image description here

             <div class="row">
                <div class="col-md-12">
                    <div class="col-md-4">
                        <div class="form-group">
                            @Html.LabelFor(m => m.LAST_NAME, htmlAttributes: new { @class = "control-label col-md-4" })
                            <div class="col-md-8">
                                @Html.TextBoxFor(m => m.LAST_NAME, htmlAttributes: new { @class = "form-control" })
                            </div>
                        </div>
                    </div>

                    <div class="col-md-4">
                        <div class="form-group">
                            @Html.LabelFor(m => m.FIRST_NAME, htmlAttributes: new { @class = "control-label col-md-4" })
                            <div class="col-md-8">
                                @Html.TextBoxFor(m => m.FIRST_NAME, htmlAttributes: new { @class = "form-control" })
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="form-group">
                            @Html.LabelFor(m => m.MIDDLE_NAME, htmlAttributes: new { @class = "control-label col-md-4" })
                            <div class="col-md-8">
                                @Html.TextBoxFor(m => m.MIDDLE_NAME, htmlAttributes: new { @class = "form-control ctrl-align-right" })
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <hr class="hrcolor" />
            <div class="row">
                <div class="col-md-12">
                    <div class="form-group">
                        <div class="col-md-8">
                            @Html.LabelFor(m => m.STREET, "Street", htmlAttributes: new { @class = "control-label col-md-2" })
                            <div class="col-md-10">
                                @Html.TextBoxFor(m => m.STREET, htmlAttributes: new { @class = "form-control" })
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="form-group">
                                @Html.LabelFor(m => m.CITY, htmlAttributes: new { @class = "control-label col-md-4" })
                                <div class="col-md-8">
                                    @Html.TextBoxFor(m => m.CITY, htmlAttributes: new { @class = "form-control" })
                                </div>
                            </div>
                        </div>
                    </div>
                 </div>
            </div>
            <div class="row">
                <div class="col-md-12">
                    <div class="col-md-4">
                        <div class="form-group">
                            @Html.LabelFor(m => m.STATE, htmlAttributes: new { @class = "control-label col-md-4" })
                            <div class="col-md-8">
                                @Html.TextBoxFor(m => m.STATE, htmlAttributes: new { @class = "form-control" })
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="form-group">
                            @Html.LabelFor(m => m.ZIP, htmlAttributes: new { @class = "control-label col-md-4" })
                            <div class="col-md-8">
                                @Html.TextBoxFor(m => m.ZIP, htmlAttributes: new { @class = "form-control" })
                            </div>
                        </div>
                    </div>

                </div>

最佳答案

text-align: right 样式应用于“Middle Name”和“City”列。

关于css - 使用水平形式对齐 Bootstrap 文本框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51527553/

相关文章:

c# - Azure 中的 ASP.NET Web 应用程序 - 如何记录错误?

asp.net - 如何提供对应用程序池身份的私钥访问?

asp.net - 使用 jQuery、Ajax 和 JSON 提交单引号

asp.net-mvc - ASP.net Web API和System.Net.Http

c# - 将具有不同关系值的表转换为 Excel 列

javascript - 使用 css 选择器,如何使用它的类获取元素的第 n 个子元素

html - CSS 选择器 : How to reference a attribute inside a div

javascript - 我该怎么做才能让我的 cookie 同意横幅为每个用户 (ip) 弹出一次

html - 花式框和网格显示问题。图片重叠

jquery - ASP.NET MVC4 jquery/javascript 包的使用