- Mastering Bootstrap 4(Second Edition)
- Benjamin Jakobus Jason Marah
- 178字
- 2021-06-24 19:25:52
Alignment
The alignment of each row can be customized, irrespective of the alignment of the previous or succeeding rows, that is, using the justify-content-start, justify-content-center, and justify-content-end classes, columns can be left-, right-, and center-aligned. For example, let's revert to our simple, unnested grid and arrange the grid in such a way that the columns on the first row are center-aligned and align the columns on the second and third row to the right and to the left, respectively. To do so, we simply add the justify-content-start class alongside the row to the first element, and the justify-content-start and justify-content-end classes to the following rows:
<div class="container">
<h1>Our Print Sizes</h1>
<div class="row justify-content-center">
<div class="col-sm-6 col-md-3">Small</div>
<div class="col-sm-6 col-md-3">Medium</div>
</div>
<div class="row justify-content-start">
<div class="col-sm-6 col-md-3">Large</div>
<div class="col-sm-6 col-md-3">Extra Large</div>
</div>
<div class="row justify-content-end">
<div class="col-sm-6 col-md-3">Enormous</div>
<div class="col-sm-6 col-md-3">Extra Enormous</div>
</div>
</div>
Columns without margin and padding
You will have noted that columns are padded. To remove the padding, you can simply apply the no-gutters class to any row. The class removes the negative margin from the default row and then the horizontal padding from all immediate children columns to prevent runaway style inheritance.
You will have noted that columns are padded. To remove the padding, you can simply apply the no-gutters class to any row. The class removes the negative margin from the default row and then the horizontal padding from all immediate children columns to prevent runaway style inheritance.
推薦閱讀
- Learning Windows Server Containers
- Ansible權(quán)威指南
- 白話區(qū)塊鏈
- 精解Windows 8
- SharePoint 2013 WCM Advanced Cookbook
- 混沌工程實(shí)戰(zhàn):手把手教你實(shí)現(xiàn)系統(tǒng)穩(wěn)定性
- Learning Bootstrap
- 深入淺出Node.js
- ElasticSearch Cookbook
- OpenSolaris設(shè)備驅(qū)動(dòng)原理與開(kāi)發(fā)
- 鴻蒙操作系統(tǒng)設(shè)計(jì)原理與架構(gòu)
- Linux內(nèi)核API完全參考手冊(cè)(第2版)
- Agile IT Security Implementation Methodology
- Learning IBM Watson Analytics
- 辦公自動(dòng)化教程(Windows7+Office2010)