Bootstrap 4 使用默认值font-size
16px,及其line-height
是1.5。
默认font-family
是 "Helvetica Neue"、Helvetica、Arial、无衬线字体。
此外,所有<p>
元素有margin-top: 0
和margin-bottom: 1rem
(默认为 16 像素)。
Bootstrap 4 样式 HTML 标题 (<h1>
到<h6>
)具有更粗的字体粗细和更大的字体大小:
显示标题用于比普通标题(更大的字体大小和更轻的字体粗细)更加突出,有四种类别可供选择:.display-1
,.display-2
,.display-3
,.display-4
在 Bootstrap 4 中,HTML<small>
元素用于在任何标题中创建更轻的辅助文本:
Bootstrap 4 将设置 HTML 样式<mark>
具有黄色背景颜色和一些填充的元素:
Bootstrap 4 将设置 HTML 样式<abbr>
底部带有虚线边框的元素:
添加.blockquote
类到一个<blockquote>
当引用其他来源的内容块时:
For 50 years, WWF has been protecting the future of nature. The world's leading conservation organization, WWF works in 100 countries and is supported by 1.2 million members in the United States and close to 5 million globally.
Bootstrap 4 将设置 HTML 样式<dl>
元素的方式如下:
Bootstrap 4 将设置 HTML 样式<code>
元素的方式如下:
Bootstrap 4 将设置 HTML 样式<kbd>
元素的方式如下:
Bootstrap 4 将设置 HTML 样式<pre>
元素的方式如下:
可以添加下面的 Bootstrap 4 类来进一步设置 HTML 元素的样式:
Class | Description | Example |
---|---|---|
.font-weight-bold |
Bold text | 尝试一下 |
.font-weight-bolder |
Bolder text | 尝试一下 |
.font-italic |
Italic text | 尝试一下 |
.font-weight-light |
Light weight text | 尝试一下 |
.font-weight-lighter |
Lighter weight text | 尝试一下 |
.font-weight-normal |
Normal text | 尝试一下 |
.lead |
Makes a paragraph stand out | 尝试一下 |
.small |
Indicates smaller text (set to 80% of the size of the parent) | 尝试一下 |
.text-left |
Indicates left-aligned text | 尝试一下 |
.text-*-left |
Indicates left-aligned text on small, medium, large or xlarge screens | 尝试一下 |
.text-break |
Prevents long text from breaking layout | 尝试一下 |
.text-center |
Indicates center-aligned text | 尝试一下 |
.text-*-center |
Indicates center-aligned text on small, medium, large or xlarge screens | 尝试一下 |
.text-decoration-none |
Removes the underline from a link | 尝试一下 |
.text-right |
Indicates right-aligned text | 尝试一下 |
.text-*-right |
Indicates right-aligned text on small, medium, large or xlarge screens | 尝试一下 |
.text-justify |
Indicates justified text | 尝试一下 |
.text-monospace |
Monospaced text | 尝试一下 |
.text-nowrap |
Indicates no wrap text | 尝试一下 |
.text-lowercase |
Indicates lowercased text | 尝试一下 |
.text-reset |
Resets the color of a text or a link (inherits the color from its parent) | 尝试一下 |
.text-uppercase |
Indicates uppercased text | 尝试一下 |
.text-capitalize |
Indicates capitalized text | 尝试一下 |
.initialism |
Displays the text inside an <abbr> element in a slightly smaller font size |
尝试一下 |
.list-unstyled |
Removes the default list-style and left margin on list items (works on both <ul> and <ol> ). This class only applies to immediate children list items (to remove the default list-style from any nested lists, apply this class to any nested lists as well) |
尝试一下 |
.list-inline |
Places all list items on a single line (used together with .list-inline-item on each <li> elements) |
尝试一下 |
.pre-scrollable |
Makes a <pre> element scrollable |
尝试一下 |
有关 Bootstrap 4 中可用的所有 CSS 类的完整参考,请访问我们的Bootstrap 4 所有类参考。