如何在引导列中并排创建嵌套div?

时间:2014-12-28 02:58:02

标签: html5 css3 twitter-bootstrap

在我的网格中,在列内,我有2个div,它们都是内联块。问题是当文本很长时,它会移到左侧并且没有正确对齐。我甚至尝试将它从内联块更改为两个div到float:left但它并没有什么区别。

我希望它像右边的2列一样对齐,但是一旦文本变长,它就不会换行,但会被移位。 demo

使用html5进行演示: http://codepen.io/anon/pen/OPRwPr

HTML:

    <header>
</header>
<main class="contain">
  <div class="row">
    <div class="col-1-3">
      <div class="title px30 lh60 pad-left-hard">
        Some Title
      </div>
      <div class="content pad-left-hard">
        <p>
          Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ut eos doloribus ea enim, iure porro inventore, architecto illum accusamus, esse modi. Laudantium iure deleniti, earum ducimus, ullam reprehenderit rerum. Nemo.
        </p>
      </div>
    </div>
    <div class="col-1-3">
      <div class="title px30 lh60 pad-left-hard">
        Some Title
      </div>
      <div class="content pad-left-hard">
        <p>
          Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ut eos doloribus ea enim, iure porro inventore, architecto illum accusamus, esse modi. Laudantium iure deleniti, earum ducimus, ullam reprehenderit rerum. Nemo.
        </p>
      </div>
    </div>
    <div class="col-1-3">
      <div class="title px30 lh60 pad-left-hard">
        Some Title
      </div>
      <div class="content pad-left-hard">
        <p>
          Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ut eos doloribus ea enim, iure porro inventore, architecto illum accusamus, esse modi. Laudantium iure deleniti, earum ducimus, ullam reprehenderit rerum. Nemo.
        </p>
      </div>
    </div>
  </div>
</main>
<footer>

</footer>

的CSS:

body {
    margin: 0;
    padding: 0;
}

.splash-container {
    position: relative;
  display: none;
    width: 100%;
    height: 10px;
    background-size: cover;
    background-image: url("../img/clouds.jpg");
}

.menu-container {
    height: 50px;
    //background: #2B2B2B;
    position: fixed;
    top: 0;
    z-index: 1;
    width: 100%;
}

.splash-logo {
    height: 400px;
}

.splash-image-container {
    position: absolute;
    width: 100%;
    height: 200px;
    text-align: center;
}

.main-points {
    min-height: 450px;
    background: #222;
    padding: 75px;
}

.points-container {
    width: 100%
}

.points-icon {
    display: inline-block;
    color: #069076;
    vertical-align: top;
}

.points-text {
    vertical-align: top;
    display: inline-block;
    color: white;
    padding: 3px 0px 0px 20px;
}

.points-title {
    font-size: 18px;
    font-weight: bold;
    margin: 0;
}

.points-desc {
    font-size: 14px;
    margin: 0;
    padding: 0;
    color: #999;
}

2 个答案:

答案 0 :(得分:1)

演示 - http://codepen.io/anon/pen/vEXazb

pull-left添加.points-icon课程,为display-table:cell添加.points-text

答案 1 :(得分:0)

float: left;添加到.points-icon

display: block;.points-text给了我CodePen

不确定这是否正是您正在寻找的......