Bootstrap格子系统(二)

1. 对其方式

1.1 垂直对齐(Vertical alignment)

<div class="container">
  <div class="row align-items-start">
    <div class="col">
      One of three columns
    </div>
    <div class="col">
      One of three columns
    </div>
    <div class="col">
      One of three columns
    </div>
  </div>
  <div class="row align-items-center">
    <div class="col">
      One of three columns
    </div>
    <div class="col">
      One of three columns
    </div>
    <div class="col">
      One of three columns
    </div>
  </div>
  <div class="row align-items-end">
    <div class="col">
      One of three columns
    </div>
    <div class="col">
      One of three columns
    </div>
    <div class="col">
      One of three columns
    </div>
  </div>
</div>

为了能观察到效果,我们设置如下的css样式:

div.row, div.col{
    border:1px solid red;
}

div.row{
    height:100px;

}

e

<div class="container">
  <div class="row">
    <div class="col align-self-start">
      One of three columns
    </div>
    <div class="col align-self-center">
      One of three columns
    </div>
    <div class="col align-self-end">
      One of three columns
    </div>
  </div>
</div>

e

1.2 水平对齐(Horizontal alignment)

<div class="container">
  <div class="row justify-content-start">
    <div class="col-4">
      One of two columns
    </div>
    <div class="col-4">
      One of two columns
    </div>
  </div>
  <div class="row justify-content-center">
    <div class="col-4">
      One of two columns
    </div>
    <div class="col-4">
      One of two columns
    </div>
  </div>
  <div class="row justify-content-end">
    <div class="col-4">
      One of two columns
    </div>
    <div class="col-4">
      One of two columns
    </div>
  </div>
  <div class="row justify-content-around">
    <div class="col-4">
      One of two columns
    </div>
    <div class="col-4">
      One of two columns
    </div>
  </div>
  <div class="row justify-content-between">
    <div class="col-4">
      One of two columns
    </div>
    <div class="col-4">
      One of two columns
    </div>
  </div>
</div>
div.row, div.col-4{
    border:1px solid red;
}

e
justify-content-start 列内容在行内左对齐
justify-content-center 列内容在行内居中对齐
justify-content-end 列内容在行内右对齐
justify-content-around 列内容在行内分散对齐,每列的左右边距一样,故中间是单边的两倍
justify-content-between 列内容在行内分别左右对齐


   Reprint policy


《Bootstrap格子系统(二)》 by 梦否 is licensed under a Creative Commons Attribution 4.0 International License
 Previous
numpy简单使用 numpy简单使用
NumPy(Numerical Python) 是 Python 语言的一个扩展程序库,支持大量的维度数组与矩阵运算,此外也针对数组运算提供大量的数学函数库。 Ndarray 对象numpy.array(object, dtype = No
2019-05-01
Next 
Bootstrap格子系统(一) Bootstrap格子系统(一)
一、格子系统(Grid system)移动设备优先的特性是因为格子系统中的12列系统,5个默认的响应层以及很多的CSS类。Bootstrap的网格系统使用一系列容器、行和列来布局和对齐内容。It’s built with flexbox a
2019-04-30
  TOC