html - Bootstrap 填充不显示标签

标签 html css twitter-bootstrap

你好,我在这里遇到一个奇怪的问题,我已经在其中创建了电子表格,但填充不显示。

enter image description here

这是我的 html:

<div class="container-fluid">
    <tabset tab-theme="orange" tab-position="top" style="border:none!important;">
        <tab heading="Person">
            <form class="form-horizontal">

                    <div class="row">
                        <!-- Text input-->
                        <div class="col-md-4">
                            <div class="form-group">
                                <label class="control-label" for="first_name">First Name</label>
                                <input id="first_name" name="first_name" placeholder="Type here.." class="form-control" required="" type="text">
                            </div>
                        </div>
                        <!-- Text input-->
                        <div class="col-md-4">
                            <div class="form-group">
                                <label class="control-label" for="last_name">Last Name</label>
                                <input id="last_name" name="last_name" placeholder="Type here.." class="form-control" required="" type="text">
                            </div>
                        </div>
                        <!-- Text input-->
                        <div class="col-md-4">
                            <div class="form-group">
                                <label class="control-label" for="other_name">Other Name</label>
                                <input id="other_name" name="other_name" placeholder="Type here.." class="form-control" type="text">
                            </div>
                        </div>
                    </div>
                </form>
        </tab>
        <tab heading="Company">
            <div class="col-xs-12">
                <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Asperiores porro eveniet debitis quas sed harum nobis libero voluptatibus dolorum odio at veniam aut id corrupti hic esse quisquam fugiat. Asperiores in eveniet sapiente error fuga tenetur ex ea dignissimos voluptas ab molestiae eos totam quo dolorem maxime illo neque quia itaque.</p>
            </div>
        </tab>
    </tabset>
</div> <!-- container-fluid -->

通常每个表单输入容器都有我默认的填充。在这种情况下没有。

我不知道这是我的 html 或 css 的问题,是否有特定的方法可以做到这一点,或者我是否必须从我的 CSS 中强制填充?

最佳答案

Bootstrap Documentation for Form Horizontal

Use Bootstrap's predefined grid classes to align labels and groups of form controls in a horizontal layout by adding .form-horizontal to the form (which doesn't have to be a ). Doing so changes .form-groups to behave as grid rows, so no need for .row.

如果您阅读 Bootstrap 的文档。它清楚地提到,.form-horizo​​ntal 中的 .form-group 充当 .row,因此,您的 col-md-xx 没有得到它们的填充。 根据您的代码:

.row {margin-left:-15px;margin-right:-15px} // margin goes negative
.col-md-xx {padding-left:15px;padding-right:15px} // padding creates 30px gutter
.form-group {margin-left:-15px;margin-right:-15px} // again your margins go negative - hence no gutter.

最好删除 form-horizo​​ntal 类或用您的自定义 css 覆盖它

工作代码笔示例:http://codepen.io/happy2deepak/pen/wKwYXJ?editors=100

关于html - Bootstrap 填充不显示标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32277868/

相关文章:

html - 无法在 bootstrap 3 中将多个列居中

html - 如何在 Bootstrap 网格中制作响应式图像堆栈

javascript - 如何在javascript中添加一行

javascript - 高级网页转换

javascript - 如何在 javascript 中为 style.width 触发媒体查询

css - 左边两个 div,右边一个,HTML 没有变化,只有 CSS

css - Bootstrap 容器在中型设备和小型设备上全屏显示,但在大型设备上显示一半

javascript - 如何限制用户输入的数量?

javascript - 黑色边框 div 形状

html - 尝试使其适合元素时背景图像被切断