css - 在移动设备中重新排序列

标签 css bootstrap-4 styles

我尝试使用 boostrap 3 创建布局,我想像这样重新排序 div 列:

从桌面列顺序(文本 - 图像,图像 - 文本):

[文本] [图像]

[图像] [文本]

[文本] [图像]

[图像] [文本]

到移动列顺序(图像文本):

[图像]

[文本]

[图像]

[文本]

[图像]

[文本]

[图像]

这是我的脚本:

<div class="row align-items-center">
            <div class="col-lg-6">
                <div class="about-content">
                    <h1>Our Story</h1>
                    <p>Void gathering midst together you're shall. Beast set he <br>likeness spirit winged two all fourth they're gathered<br> seasons very may heaven saying. Fly image th</p>
                </div>
            </div>
            <div class="col-md-6 col-lg-6 mb-4 mb-lg-4">
                <div class="about-img">
                    <img src="img/banner/new2.png" alt="">
                </div>
            </div>
            <div class="col-md-6 col-lg-6 mb-4 mb-lg-4">
                <div class="about-img">
                    <img src="img/banner/icon.png" alt="">
                </div>
            </div>
            <div class="col-lg-6">
                <div class="about-content">
                    <h3>Our Story</h3>
                    <p>Void gathering midst together you're shall. Beast set he <br>likeness spirit winged two all fourth they're gathered<br> seasons very may heaven saying. Fly image th</p>
                </div>
            </div>
             <div class="col-lg-6">
                <div class="about-content">
                    <h3>Our Story</h3>
                    <p>Void gathering midst together you're shall. Beast set he <br>likeness spirit winged two all fourth they're gathered<br> seasons very may heaven saying. Fly image th</p>
                </div>
            </div>
             <div class="col-md-6 col-lg-6 mb-4 mb-lg-4">
                <div class="about-img">
                    <img src="img/banner/icon2.png" alt="">
                </div>
            </div>
            <div class="col-md-6 col-lg-6 mb-4 mb-lg-4">
                <div class="about-img">
                    <img src="img/banner/icon1.png" alt="">
                </div>
            </div>
            <div class="col-lg-6">
                <div class="about-content">
                    <h3>Our Story</h3>
                    <p>Void gathering midst together you're shall. Beast set he <br>likeness spirit winged two all fourth they're gathered<br> seasons very may heaven saying. Fly image th</p>
                </div>
            </div>
            <div class="col-lg-5">
                <div class="about-content">
                    <h3>Our Story</h3>
                    <p>Void gathering midst together you're shall. Beast set he <br>likeness spirit winged two all fourth they're gathered<br> seasons very may heaven saying. Fly image th</p>
                </div>
            </div>
            <div class="col-md-6 col-lg-6 mb-4 mb-lg-4">
                <div class="about-img">
                    <img src="img/banner/4.png" alt="">
                </div>
            </div>
        </div>

最佳答案

请试试这个代码:

<!DOCTYPE html>
<html>
<head>

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>

  <style>
    @media (max-width: 991px) {
      .column-reverse {
        display: flex;
        flex-direction: column-reverse;
      }
    }
  </style>
</head>
<body>
<div class="container">
    <div class="row align-items-center column-reverse">
      <div class="col-lg-6">
          <div class="about-content">
              <h1>Our Story</h1>
              <p>Void gathering midst together you're shall. Beast set he <br>likeness spirit winged two all fourth they're gathered<br> seasons very may heaven saying. Fly image th</p>
          </div>
      </div>
      <div class="col-md-6 col-lg-6 mb-4 mb-lg-4">
          <div class="about-img">
              <img src="http://qnimate.com/wp-content/uploads/2014/03/images2.jpg" class="img-responsive" alt="">
          </div>
      </div>
    </div>

    <div class="row align-items-center">  
      <div class="col-md-6 col-lg-6 mb-4 mb-lg-4">
          <div class="about-img">
              <img src="http://qnimate.com/wp-content/uploads/2014/03/images2.jpg" class="img-responsive" alt="">
          </div>
      </div>
      <div class="col-lg-6">
          <div class="about-content">
              <h3>Our Story</h3>
              <p>Void gathering midst together you're shall. Beast set he <br>likeness spirit winged two all fourth they're gathered<br> seasons very may heaven saying. Fly image th</p>
          </div>
      </div>
    </div>

    <div class="row align-items-center column-reverse">  
       <div class="col-lg-6">
          <div class="about-content">
              <h3>Our Story</h3>
              <p>Void gathering midst together you're shall. Beast set he <br>likeness spirit winged two all fourth they're gathered<br> seasons very may heaven saying. Fly image th</p>
          </div>
      </div>
       <div class="col-md-6 col-lg-6 mb-4 mb-lg-4">
          <div class="about-img">
              <img src="http://qnimate.com/wp-content/uploads/2014/03/images2.jpg" class="img-responsive" alt="">
          </div>
      </div>
    </div>

    <div class="row align-items-center">  
      <div class="col-md-6 col-lg-6 mb-4 mb-lg-4">
          <div class="about-img">
              <img src="http://qnimate.com/wp-content/uploads/2014/03/images2.jpg" class="img-responsive" alt="">
          </div>
      </div>
      <div class="col-lg-6">
          <div class="about-content">
              <h3>Our Story</h3>
              <p>Void gathering midst together you're shall. Beast set he <br>likeness spirit winged two all fourth they're gathered<br> seasons very may heaven saying. Fly image th</p>
          </div>
      </div>
    </div>

    <div class="row align-items-center column-reverse">  
      <div class="col-lg-5">
          <div class="about-content">
              <h3>Our Story</h3>
              <p>Void gathering midst together you're shall. Beast set he <br>likeness spirit winged two all fourth they're gathered<br> seasons very may heaven saying. Fly image th</p>
          </div>
      </div>
      <div class="col-md-6 col-lg-6 mb-4 mb-lg-4">
          <div class="about-img">
              <img src="http://qnimate.com/wp-content/uploads/2014/03/images2.jpg" class="img-responsive" alt="">
          </div>
      </div>
    </div>
    </div>
</body>
</html>

关于css - 在移动设备中重新排序列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55841752/

相关文章:

javascript - 如何使用 JavaScript 选择用户可以切换到的所有 html 元素?

html - Bootstrap 4 表单输入 - 对齐复选框

javascript - Bootstrap 4 - 模态视频重新加载

C# WPF 样式 : One Button Mouseover - One Button keep Image

Python Selenium 使用 PhantomJS webdriver 禁用 CSS

html - Bootstrap 3.0 和 nicescroll 插件显示在导航栏下

html - 什么会导致 td 元素忽略样式 ="width:300px"?

c# - 在 WPF DataGrid 控件中设置选定单元格的样式

javascript - 接下来如何在react SSR框架中使用TS+css+scss?

html - Bootstrap 4 : How to have cards in a row with different height?