【发布时间】:2016-10-06 23:18:26
【问题描述】:
尝试在没有 html 框架附带的所有额外代码的情况下复制 Bootstrap 列。
我以前做过的简单的 html 和 css,但对于我的生活,我无法弄清楚为什么它们不会浮动并并排放置。
两列宽度为 50%,内边距为 15 像素,父 div 称为“行”,边距为 -15 像素,容器为 15 像素。为什么我不能让它工作?
HTML:
<div class="container">
<div class="form-row row clearfix">
<div class="form-group col-sm-6">
test
</div>
<div class="form-group col-sm-6">
test
</div>
</div>
</div>
CSS:
.container {
margin-right: auto;
margin-left: auto;
padding-left: 15px;
padding-right: 15px
}
.row {
margin-left: -15px;
margin-right: -15px
}
/*COLUMNS*/
@media (min-width: 768px) {
.col-sm-6 {
width: 50%;
}
.col-sm-12 {
width: 100%;
}
}
/*FORM*/
.form-group {
padding: 0 15px 15px 15px;
float: left;
background: blue;
}
【问题讨论】:
标签: css twitter-bootstrap-3 css-float