html - 标签前的 Bootstrap 列空间

标签 html css twitter-bootstrap

您好,如何在此 div 中的标签前添加空格?我正在使用 Bootstrap 网格系统。是否可以不用填充来做到这一点?

screenshot

<div class="module-body">
                                    <div class="row">
                                        <label class="event-label col-md-2" style="font-size:16px">Event:</label>
                                        <input type="text" class="event-input">
                                    </div>
                                    <div class="row">
                                        <label class="event-label col-md-2" style="font-size:16px">When:</label>
                                    </div>
                                    <div class="row">                                    
                                        <label class="event-label col-md-2" style="font-size:16px">Where:</label>
                                        <input type="text" class="event-input">
                                    </div>
                                    <div class="row">
                                        <label class="event-label col-md-2" style="font-size:16px">Cause:</label>
                                    </div>
                                    <div class="row">
                                        <label class="event-label col-md-2" style="font-size:16px">Preferred Skills:</label>
                                        <input type="text" class="event-input">
                                    </div>
                                    <div class="row">
                                        <label class="event-label col-md-2" style="font-size:16px">No. of Volunteers:</label>
                                    </div>
                                    <div class="row">
                                        <label class="description-label col-md-2" style="font-size:16px">Description:</label>
                                    </div>
                                        <input type="text" class="event-description">
                                </div>                 

最佳答案

您只需将 container 类添加到您的包装器 div 中,或者如果您想要一个全宽容器,您可以使用 container-fluid 类而不是容器

<div class="module-body container">

Rows must be placed within a .container (fixed-width) or .container-fluid (full-width) for proper alignment and padding.

您要为每个标签和输入组添加一行,这不是一个好的做法。

@import url(https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css);
<div class="module-body container">
                                    <div class="row">
                                        <label class="event-label col-md-2" style="font-size:16px">Event:</label>
                                        <input type="text" class="event-input">
                                    </div>
                                    <div class="row">
                                        <label class="event-label col-md-2" style="font-size:16px">When:</label>
                                    </div>
                                    <div class="row">                                    
                                        <label class="event-label col-md-2" style="font-size:16px">Where:</label>
                                        <input type="text" class="event-input">
                                    </div>
                                    <div class="row">
                                        <label class="event-label col-md-2" style="font-size:16px">Cause:</label>
                                    </div>
                                    <div class="row">
                                        <label class="event-label col-md-2" style="font-size:16px">Preferred Skills:</label>
                                        <input type="text" class="event-input">
                                    </div>
                                    <div class="row">
                                        <label class="event-label col-md-2" style="font-size:16px">No. of Volunteers:</label>
                                    </div>
                                    <div class="row">
                                        <label class="description-label col-md-2" style="font-size:16px">Description:</label>
                                    </div>
                                        <input type="text" class="event-description">
                                </div>           

关于html - 标签前的 Bootstrap 列空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40825790/

相关文章:

html - 为什么第二行td与第一行宽度相同

html - 问题设计 Bootstrap 导航栏

html - svg 圆圈悬停仅适用于边框

html - 类似于 media temple 主页的响应图像

python - 使用 Django 和 Bootstrap 设计表单

php - 为什么上传代码不能在 firefox 28 以外的浏览器中工作?

javascript - HTML/JS 拖放内容在笔记本电脑版本中有效,但在移动 View 中无效

css - 如何在 flex 容器中排列两个居中 div 的顶部?

javascript - 单击外部时关闭下拉菜单

twitter-bootstrap - 使 toastr 警报看起来像 Bootstrap 警报