- 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.
推薦閱讀
- 網絡操作系統:Windows Server 2003管理與應用
- 蘋果電腦玩全攻略 OS X 10.8 Mountain Lion
- 嵌入式應用程序設計綜合教程(微課版)
- Extending Bootstrap
- Linux系統安全基礎:二進制代碼安全性分析基礎與實踐
- Microsoft Operations Management Suite Cookbook
- OpenSolaris設備驅動原理與開發
- Python UNIX和Linux系統管理指南
- HTML5 Enterprise Application Development
- 統信UOS應用開發進階教程
- Docker容器技術與應用
- 電腦辦公(Windows 10 + Office 2016)入門與提高(超值版)
- Mastering Sass
- Linux深度攻略
- 15分鐘!畫出我的漫畫角色:賣萌篇