2

这就是我在 LG 设计中所拥有的。

    +-----+-----+
    |  A  |  B  |
    +-----+-----+
    |  C  |  D  |
    +-----+-----+

我想在 MD 设计中重新排序,如下所示:

    +---------+---------+
    |         A         |
    +---------+---------+
    | C   |   D  |  B   |
    +-------------------+

有没有办法让我把“B”从第一排推到第二排,在那个位置?:)

4

2 回答 2

3

尝试这样的事情:

.row div {
  border: 1px solid black;
  }
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />

<div class="container">
  <div class="row">
    <div class="col-lg-6 col-md-12">A</div>
    <div class="col-lg-6 col-md-4 col-md-push-8 col-lg-push-0">B</div>
    <div class="col-lg-6 col-md-4 col-md-pull-4 col-lg-pull-0">C</div>
    <div class="col-lg-6 col-md-4 col-md-pull-4 col-lg-pull-0">D</div>
  </div>
</div>

通过将类添加col-md-12到 A 列,它将占用整行,B 列将流到下一行。但是,它将出现在左侧。如果您希望它出现在右侧,则必须指定col-*-pull-*col-*-push-*类。

于 2016-04-26T07:46:44.687 回答
1

这很简单,可以通过定义类“col-md-n col-lg-n col-md-push-m col-lg-push-m”来完成(其中 n= 你想在 md 上显示的列数或 lg 屏幕,m 是推拉类的列数)。检查这个片段。切换到整页并放大以查看更改。

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container-fluid">
    
  <div class="row">
    <div class="col-lg-6 col-md-12 text-center" style="border:1px dashed pink;">
      <h1>A</h1>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.<br>
      Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
    </div>
    <div class="col-lg-6 col-md-4  col-md-push-8 col-lg-push-0 text-center" style="border:1px dashed pink;">
        <h1>B</h1>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.<br>
      Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
    </div>
      <div class="col-lg-6 col-md-4 col-md-pull-4 col-lg-pull-0 text-center" style="border:1px dashed pink;">
        <h1>C</h1>
       Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.<br>
      Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.  
    </div>
      <div class="col-lg-6 col-md-4 col-md-pull-4 col-lg-pull-0 text-center" style="border:1px dashed pink;">
        <h1>D</h1>
       Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.<br>
      Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.    
    </div>
  </div>
</div>
    
</body>
</html>

于 2016-04-26T07:49:11.553 回答