- Bootstrap 4 By Example
- Silvio Moreto
- 350字
- 2021-07-09 20:01:20
Final thoughts
Before ending this chapter, we must get some things clear. Bootstrap offers some helper classes mixins and some vendor's mixins, which offer cross-browser compatibility support.
Box-sizing
Bootstrap 3 started using box-sizing: border-box
for all elements and pseudo-elements. With this enabled, the width and height properties start to include the padding and the border but not the margin.
With that, it is easier to set the right sizing for your elements. This is because any change that you make in the element, such as customizing the padding of a .row
, will reflect the width and height of the whole element. The following figure shows you the differences of box-sizing.

Note
Pseudo-elements are the text placed after the :
sign in the CSS style. They are used to style specific parts of elements, such as :after
and :before
, which are the most common pseudo-elements.
Quick floats
Bootstrap offers quick classes to make an element float. Add the .pull-left
or .pull-right
class to make the elements float left or right, respectively. Keep in mind that both classes apply the !important
modifier to avoid override issues:
<p class="pull-left"></p> <p class="pull-right"></p>
Note
In the next chapters, we will present the navbar components. Remember that if you want to align an element inside a navbar, you should use .navbar-left
and .navbar-right
instead of .pull-left
and .pull-right
.
Clearfix
Clearfix is a way of clearing the floating of an element related to its child element. The Bootstrap columns are all floated left, and the parent row has a clearfix. This makes every column appear right next to each other, and the row does not overlap with other rows. This figure exemplifies how clearfix works:

So, if you want to add the clearfix to a new element or pseudo-element, add the .clearfix
class and you can get the hard work quickly done.
Font definitions for typography
In the following table, the font sizes for default text and heading are presented. It describes the heading, font family, and line height. It is important to make it explicit for you to deeply understand the Bootstrap default configuration if you want a different customization.


- EJB 3.1從入門到精通
- 面向物聯網的CC2530與傳感器應用開發
- EDA技術與VHDL編程
- Hands-On Chatbot Development with Alexa Skills and Amazon Lex
- Go Web Scraping Quick Start Guide
- HTML5 Game development with ImpactJS
- 通信簡史:從信鴿到6G+
- Metasploit Penetration Testing Cookbook
- 智慧光網絡:關鍵技術、應用實踐和未來演進
- Microservice Patterns and Best Practices
- 網絡綜合布線(第2版)
- TCP/IP基礎(第2版)
- 園區網絡架構與技術
- 無線傳感器網絡定位方法及應用
- SD-WAN 架構與技術