Bootstrap 4 Văn bản/kiểu chữ
Cài đặt mặc định của Bootstrap 4
Bootstrap 4 sử dụng font-size
mặc định là 16px và line-height
của nó là 1,5.
Họ font-family
mặc định là "Helvetica Neue", Helvetica, Arial, sans-serif.
Ngoài ra, tất cả phần tử <p>
đều có margin-top: 0
và margin-bottom: 1rem
(mặc định là 16px).
<h1> - <h6>
Bootstrap 4 kiểu tiêu đề HTML ( <h1>
đến <h6>
) với độ dày phông chữ đậm hơn và kích thước phông chữ tăng:
Ví dụ
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)
Hiển thị tiêu đề
Tiêu đề hiển thị được sử dụng để nổi bật hơn các tiêu đề thông thường (cỡ chữ lớn hơn và độ dày phông chữ nhẹ hơn) và có bốn lớp để chọn: .display-1
, .display-2
, .display-3
, .display-4
<nhỏ>
Trong Bootstrap 4, phần tử HTML <small>
được sử dụng để tạo văn bản phụ, nhẹ hơn trong bất kỳ tiêu đề nào:
Ví dụ
h1 heading secondary text
h2 heading secondary text
h3 heading secondary text
h4 heading secondary text
h5 heading secondary text
h6 heading secondary text
<dấu>
Bootstrap 4 sẽ tạo kiểu cho phần tử HTML <mark>
với màu nền màu vàng và một số phần đệm:
<abbr>
Bootstrap 4 sẽ tạo kiểu cho phần tử HTML <abbr>
có viền chấm ở dưới:
<trích dẫn khối>
Thêm lớp .blockquote
vào <blockquote>
khi trích dẫn các khối nội dung từ nguồn khác:
Ví dụ
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.
<dl>
Bootstrap 4 sẽ định kiểu phần tử HTML <dl>
theo cách sau:
<mã>
Bootstrap 4 sẽ định kiểu phần tử HTML <code>
theo cách sau:
Ví dụ
The following HTML elements: span
, section
, and div
defines a section in a document.
<kbd>
Bootstrap 4 sẽ định kiểu phần tử HTML <kbd>
theo cách sau:
<trước>
Bootstrap 4 sẽ định kiểu phần tử HTML <pre>
theo cách sau:
Ví dụ
is displayed in a fixed-width
font, and it preserves
both spaces and
line breaks.
Thêm các lớp học về kiểu chữ
Các lớp Bootstrap 4 bên dưới có thể được thêm vào để tạo kiểu cho các thành phần HTML hơn nữa:
Class | Description | Example |
---|---|---|
.font-weight-bold |
Bold text | Try it |
.font-weight-bolder |
Bolder text | Try it |
.font-italic |
Italic text | Try it |
.font-weight-light |
Light weight text | Try it |
.font-weight-lighter |
Lighter weight text | Try it |
.font-weight-normal |
Normal text | Try it |
.lead |
Makes a paragraph stand out | Try it |
.small |
Indicates smaller text (set to 80% of the size of the parent) | Try it |
.text-left |
Indicates left-aligned text | Try it |
.text-*-left |
Indicates left-aligned text on small, medium, large or xlarge screens | Try it |
.text-break |
Prevents long text from breaking layout | Try it |
.text-center |
Indicates center-aligned text | Try it |
.text-*-center |
Indicates center-aligned text on small, medium, large or xlarge screens | Try it |
.text-decoration-none |
Removes the underline from a link | Try it |
.text-right |
Indicates right-aligned text | Try it |
.text-*-right |
Indicates right-aligned text on small, medium, large or xlarge screens | Try it |
.text-justify |
Indicates justified text | Try it |
.text-monospace |
Monospaced text | Try it |
.text-nowrap |
Indicates no wrap text | Try it |
.text-lowercase |
Indicates lowercased text | Try it |
.text-reset |
Resets the color of a text or a link (inherits the color from its parent) | Try it |
.text-uppercase |
Indicates uppercased text | Try it |
.text-capitalize |
Indicates capitalized text | Try it |
.initialism |
Displays the text inside an <abbr> element in a slightly smaller font size |
Try it |
.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) |
Try it |
.list-inline |
Places all list items on a single line (used together with
.list-inline-item on each <li> elements) |
Try it |
.pre-scrollable |
Makes a <pre> element scrollable |
Try it |
Toàn bộ tài liệu tham khảo CSS Bootstrap 4
Để có tài liệu tham khảo đầy đủ về tất cả các lớp CSS có sẵn trong Bootstrap 4, hãy truy cập Tài liệu tham khảo tất cả các lớp Bootstrap 4 của chúng tôi.