![Bootstrap基础教程](https://wfqqreader-1252317822.image.myqcloud.com/cover/864/53286864/b_53286864.jpg)
上QQ阅读APP看书,第一时间看更新
3.1 排版
排版主要是使用 CSS 对 HTML 元素进行样式设置及布局定位,排版在前端开发中的重要性不言而喻。Bootstrap提供了一套CSS样式,可以方便用户快速地渲染修饰HTML元素,让页面排版变得更简单。
Bootstrap 4.6.0默认的 font-size 为1rem(16px),line-height 为1.5。默认的 font-family 为Helvetica Neue、Helvetica、Arial、sans-serif等字体。此外,所有的 <p> 元素 margin-top: 0、margin-bottom: 1rem (16px)。具体定义如下。
html{ font-family:sans-serif; line-height:1.15; -webkit-text-size-adjust:100%; -webkit-tap-highlight-color:rgba(0,0,0,0); } body{ margin:0; font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"; font-size:1rem; font-weight:400; line-height:1.5; color:#212529; text-align:left; background-color:#fff; }
在Bootstrap 4.6.0中,元素使用rem尺寸单位。rem是CSS3中新增的一种相对长度单位。在使用rem单位时,根节点<html>的字体大小决定了rem的尺寸。在Bootstrap 4.6.0中,1rem为16px,2rem为32px。