如何将 div 和行与 bootstrap 对齐

How to align divs and rows with bootstrap

我无法对齐嵌套行。见下图。我在 md 和 lg 屏幕上有 1 行作为 9,3 行作为 3。9+3=12。在 sm 屏幕中,我希望第一行为 12,其他 3 行在它下面(4+4+4)。

https://s28.postimg.org/f0xa2380t/helpbootstrap.png

    <div class="container">         
<div class="row">
  <div class="col-md-9 col-sm-12">
    <div class="row ">  
        <div class="col-md-12 large">
        </div>
    </div>
  </div>
  <div class="col-md-3 col-sm-12">
    <div class="row ">
        <div class="col-md-12 col-sm-4 small">
        </div>
    </div>
    <div class="row">
        <div class="col-md-12 col-sm-4 small">
        </div>
    </div>
    <div class="row">
        <div class="col-md-12 col-sm-4 small">
        </div>
    </div>          
  </div>  
</div>

    .small{ height:100px; border: 1px solid;} .large{ height:200px; border: 1px solid;  }

https://jsfiddle.net/proabid/qLg72vns/

您只需要删除第二个 div 中的行:

<div class="container">
  <div class="row">
    <div class="col-md-9 col-sm-12">
      <div class="row ">
        <div class="col-md-12 large">
        </div>
      </div>
    </div>
    <div class="col-md-3 col-sm-12">
      <div class="row">
        <div class="col-md-12 col-sm-4 small">
        </div>
        <div class="col-md-12 col-sm-4 small">
        </div>
        <div class="col-md-12 col-sm-4 small">
        </div>
      </div>
    </div>
  </div>
</div>

Example bootply

这可以使用 Bootstrap v4

<div class="container">
 <div class="row">
   <div class="col-md-9 col-sm-12 large">
     <p>
       Lorem ipsum dolor sit amet, consectetur adipisicing elit. Impedit qui     exercitationem placeat doloribus aut id recusandae pariatur. Illum, porro aut ullam? Adipisci tempora fugiat quam quos dolorem, blanditiis dicta magni.
     </p>
   </div>
  <div class="col-md-3 col-sm-3 col-xs-4 small">
   <p>
    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Impedit qui exercitationem placeat doloribus aut id recusandae pariatur. Illum, porro aut ullam? Adipisci tempora fugiat quam quos dolorem, blanditiis dicta magni.
   </p>
  </div>
  <div class="col-md-3 offset-md-9 col-sm-3 col-xs-4 small">
   <p>
    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Impedi qui exercitationem placeat doloribus aut id recusandae pariatur. Illum, porro aut ullam? Adipisci tempora fugiat quam quos dolorem, blanditiis dicta magni.
   </p>
  </div>
  <div class="col-md-3 offset-md-9 col-sm-3 col-xs-4 small">
   <p>
    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Impedit qui exercitationem placeat doloribus aut id recusandae pariatur. Illum, porro aut ullam? Adipisci tempora fugiat quam quos dolorem, blanditiis dicta magni.
   </p>
  </div>
</div>

JSFIDDLE

https://jsfiddle.net/qLg72vns/8/

@Procode 请使用示例文本检查以下代码:

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
   <div class="col-lg-9 col-md-9 col-sm-12 col-xs-12">
             <p>ABCD</p>
            </div>
            <div class="col-lg-3 col-md-3 col-sm-12 col-xs-12">
              <div class="col-lg-12 col-md-12 col-sm-4 col-xs-4">
              <p>ABCD</p>
                </div>
                <div class="col-lg-12 col-md-12 col-sm-4 col-xs-4">
              <p>ABCD</p>
                </div>
                <div class="col-lg-12 col-md-12 col-sm-4 col-xs-4">
              <p>ABCD</p>
                </div>
            </div>
</div>

删除多余的行确实解决了我的问题。