HTML - 重新排序Bootstrap列

时间:2017-01-24 14:37:41

标签: html css twitter-bootstrap twitter-bootstrap-3

我有三个div,如下图所示: Design

如何使用Bootstrap-3实现所需的布局?

HTML:

 <div class="row">
     <div class="col-md-5" col-md-push-7>
        <div>1</div>
        <div>3</div>
     <div>
     <div class="col-md-7" col-md-push-5>
        <div>2</div>
     </div>
  </div>

1 个答案:

答案 0 :(得分:1)

使用以下代码结构来实现此布局:

<div class="container">
  <div class="row">
    <div class="col-xs-12 col-sm-7 pull-right">1</div>
    <div class="col-xs-12 col-sm-5">2</div>
    <div class="col-xs-12 col-sm-7 pull-right">3</div>
  </div>
</div>

.box {
  border: 2px solid black;
  margin-bottom: 10px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
  <div class="row">
    <div class="col-xs-12 col-sm-7 pull-right">
      <div class="box">1</div>
    </div>
    <div class="col-xs-12 col-sm-5">
      <div class="box box2">2</div>
    </div>
    <div class="col-xs-12 col-sm-7 pull-right">
      <div class="box">3</div>
    </div>
  </div>
</div>