Bootstrap4 文字/排版


Bootstrap 4 默认设置

Bootstrap 4 使用默认值font-size16px,及其line-height是1.5。

默认font-family是 "Helvetica Neue"、Helvetica、Arial、无衬线字体。

此外,所有<p>元素有margin-top: 0margin-bottom: 1rem(默认为 16 像素)。


<h1> - <h6>

Bootstrap 4 样式 HTML 标题 (<h1><h6>)具有更粗的字体粗细和更大的字体大小:

示例

h1 Bootstrap heading (2.5rem = 40px)

h2 Bootstrap heading (2rem = 32px)

h3 Bootstrap heading (1.75rem = 28px)

h4 Bootstrap heading (1.5rem = 24px)

h5 Bootstrap heading (1.25rem = 20px)
h6 Bootstrap heading (1rem = 16px)
亲自试一试 »

显示标题

显示标题用于比普通标题(更大的字体大小和更轻的字体粗细)更加突出,有四种类别可供选择:.display-1,.display-2,.display-3,.display-4

示例

Display 1

Display 2

Display 3

Display 4

亲自试一试 »

<小>

在 Bootstrap 4 中,HTML<small>元素用于在任何标题中创建更轻的辅助文本:

示例

h1 heading secondary text

h2 heading secondary text

h3 heading secondary text

h4 heading secondary text

h5 heading secondary text
h6 heading secondary text
亲自试一试 »


<标记>

Bootstrap 4 将设置 HTML 样式<mark>具有黄色背景颜色和一些填充的元素:

示例

Use the mark element to highlight text.

亲自试一试 »

<缩写>

Bootstrap 4 将设置 HTML 样式<abbr>底部带有虚线边框的元素:

示例

The WHO was founded in 1948.

亲自试一试 »

<块引用>

添加.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.


From WWF's website
亲自试一试 »

<dl>

Bootstrap 4 将设置 HTML 样式<dl>元素的方式如下:

示例

Coffee
- black hot drink
Milk
- white cold drink
亲自试一试 »

<代码>

Bootstrap 4 将设置 HTML 样式<code>元素的方式如下:

示例

The following HTML elements: span, section, and div defines a section in a document.

亲自试一试 »

<KBD>

Bootstrap 4 将设置 HTML 样式<kbd>元素的方式如下:

示例

Use ctrl + p to open the Print dialog box.

亲自试一试 »

<前>

Bootstrap 4 将设置 HTML 样式<pre>元素的方式如下:

示例

Text in a pre element
is displayed in a fixed-width
font, and it preserves
both      spaces and
line breaks.
亲自试一试 »

更多版式课程

可以添加下面的 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 中可用的所有 CSS 类的完整参考,请访问我们的Bootstrap 4 所有类参考