官术网_书友最值得收藏!

  • Bootstrap 4:Responsive Web Design
  • Silvio Moreto Matt Lambert Benjamin Jakobus Jason Marah
  • 350字
  • 2021-07-09 18:54:42

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.

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:

<div class="pull-left"></div>
<div class="pull-right"></div>

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:

Clearfix

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.

主站蜘蛛池模板: 庐江县| 安泽县| 西华县| 涿州市| 离岛区| 铁岭市| 唐山市| 江孜县| 巴青县| 澳门| 巴林左旗| 错那县| 林芝县| 类乌齐县| 乌恰县| 余干县| 石首市| 枣强县| 会理县| 兴国县| 化州市| 哈巴河县| 昌平区| 凤冈县| 黄平县| 孙吴县| 南岸区| 繁昌县| 名山县| 伊宁市| 明溪县| 江北区| 山丹县| 衢州市| 庐江县| 崇文区| 新密市| 宜昌市| 渝北区| 文登市| 明溪县|