css - 如何在 bootstrap 中使用 Lesser div

标签 css html twitter-bootstrap-3 grid-layout

使用 bootstrap 3.3.7 想要的结构可以在下面的链接中找到。问题是通过尽可能少地使用div来解决这种网格系统。 首先,我们有一个带有 col 类的 div,它占据了整个 block 。接下来,我们在它下面有另一个网格,它也占据了大屏幕上的整个 block 。而在手机上,第一个网格将占据左侧部分,另一个网格将占据右侧。

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
  <div class="col-md-3 col-xs-12">
    <div class="col-md-12 col-sm-3 col-xs-3" style="border:1px solid;">
      <span> here goes the image  on the top
                    - on small device it should be to the left 
                    </span>
    </div>
    <div class="col-md-12 col-sm-7 col-xs-8" style="border:1px solid;">
      <span> here goes the content on the bottom that include some other grids
                    - on small device it should be to the right of the image above
        </span>
    </div>
  </div>
  <div class="col-md-3 col-md-offset-6 col-xs-12">
    <div class="col-md-12 col-sm-3 col-xs-3" style="border:1px solid;">
      <span>
        *Second div*
        here goes the image  on the top
                    - on small device it should be to the left 
                    </span>
    </div>
    <div class="col-md-12 col-sm-7 col-xs-8" style="border:1px solid;">
      <span> here goes the content on the bottom that include some other grids
                    - on small device it should be to the right of the image above
        </span>
    </div>
  </div>
</div>

最佳答案

使用此代码并更改您的 col-xs-[] col-md-[] 并享受..

.border{
border:1px solid red;
}
.height{
min-height: 100px !important;
}
<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-4 border height">
    <div>
      here goes the content on the bottom that include some other grids - on small device it should be to the right of the image above

    </div>
  </div>
  <div class="col-xs-8 border height">
    <div>
      here goes the content on the bottom that include some other grids - on small device it should be to the right of the image above

    </div>
  </div>
</div>

<div class="row">
  <div class="col-xs-4 border height">
    <div>
      here goes the content on the bottom that include some other grids - on small device it should be to the right of the image above

    </div>
  </div>
  <div class="col-xs-8 border height">
    <div>
      here goes the content on the bottom that include some other grids - on small device it should be to the right of the image above

    </div>
  </div>
</div>

</div>

关于css - 如何在 bootstrap 中使用 Lesser div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42231299/

相关文章:

javascript - 将所有 ng-if 设置为 false on click 除了被点击的项目

javascript - 过滤json数据并将结果显示在表格中

javascript - Canvas 动画似乎没有以 60 fps 的速度运行

javascript - 十六进制颜色 - 使其更亮的配方

javascript - SlideToggle() 不会将使用 jquery append() 创建的元素向下推

html - maxDate 日期选择器不工作

twitter-bootstrap-3 - 嵌入自适应YouTube视频未显示

javascript - 在 bootstrap 3 中更改药丸颜色并且导航药丸可以折叠

css - 将 CSS 生成的三 Angular 形拆分为 2 个水平不同的相同颜色

html - 有时字体在 chrome 中看起来很奇怪