Teks Bootstrap /Tipografi
Pengaturan Default Bootstrap
Ukuran font default global Bootstrap adalah 14px, dengan tinggi garis 1,428.
Ini diterapkan ke <body>
elemen dan semua paragraf ( <p>
).
Selain itu, semua <p>
elemen memiliki margin bawah yang sama dengan setengah tinggi garis yang dihitung (10px secara default).
Bootstrap vs. Default Browser
Dalam bab ini, kita akan melihat beberapa elemen HTML yang akan ditata sedikit berbeda oleh Bootstrap daripada default browser.
<h1> - <h6>
Secara default, Bootstrap akan memberi style pada heading HTML ( <h1>
to
<h6>
) dengan cara berikut:
Contoh
h1 Bootstrap heading (36px)
h2 Bootstrap heading (30px)
h3 Bootstrap heading (24px)
h4 Bootstrap heading (18px)
h5 Bootstrap heading (14px)
h6 Bootstrap heading (12px)
<kecil>
Di Bootstrap, elemen HTML <small>
digunakan untuk membuat teks sekunder yang lebih ringan di judul apa pun:
Contoh
h1 heading secondary text
h2 heading secondary text
h3 heading secondary text
h4 heading secondary text
h5 heading secondary text
h6 heading secondary text
<tanda>
Bootstrap akan menata elemen HTML <mark>
dengan cara berikut:
Contoh
Use the mark element to highlight text.
<abbr>
Bootstrap akan menata elemen HTML <abbr>
dengan cara berikut:
Contoh
The WHO was founded in 1948.
<blockquote>
Bootstrap akan menata elemen HTML <blockquote>
dengan cara berikut:
Contoh
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.
Untuk menampilkan kutipan di sebelah kanan, gunakan .blockquote-reverse
kelas:
Contoh
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 akan menata elemen HTML <dl>
dengan cara berikut:
Contoh
- Coffee
- - black hot drink
- Milk
- - white cold drink
<kode>
Bootstrap akan menata elemen HTML <code>
dengan cara berikut:
Contoh
The following HTML elements: span
, section
, and div
defines a section in a document.
<kbd>
Bootstrap akan menata elemen HTML <kbd>
dengan cara berikut:
Contoh
Use ctrl + p to open the Print dialog box.
<pra>
Bootstrap akan menata elemen HTML <pre>
dengan cara berikut:
Contoh
Text in a pre element is displayed in a fixed-width font, and it preserves both spaces and line breaks.
Warna dan Latar Belakang Kontekstual
Bootstrap juga memiliki beberapa kelas kontekstual yang dapat digunakan untuk memberikan "makna melalui warna".
Kelas untuk warna teks adalah: .text-muted
,
.text-primary
, .text-success
, .text-info
,
.text-warning
, dan .text-danger
:
Contoh
This text is muted.
This text is important.
This text indicates success.
This text represents some information.
This text represents a warning.
This text represents danger.
Kelas untuk warna latar belakang adalah: .bg-primary
,
.bg-success
, .bg-info
, .bg-warning
, dan .bg-danger
:
Contoh
This text is important.
This text indicates success.
This text represents some information.
This text represents a warning.
This text represents danger.
Lebih Banyak Kelas Tipografi
Kelas Bootstrap di bawah ini dapat ditambahkan ke elemen HTML gaya lebih lanjut:
Class | Description | Example |
---|---|---|
.lead |
Makes a paragraph stand out | |
.small |
Indicates smaller text (set to 85% of the size of the parent) | |
.text-left |
Indicates left-aligned text | |
.text-center |
Indicates center-aligned text | |
.text-right |
Indicates right-aligned text | |
.text-justify |
Indicates justified text | |
.text-nowrap |
Indicates no wrap text | |
.text-lowercase |
Indicates lowercased text | |
.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 | |
.dl-horizontal |
Lines up the terms (<dt> ) and descriptions (<dd> ) in
<dl> elements side-by-side. Starts off like default <dl> s, but when the browser window expands, it will line up side-by-side |
|
.pre-scrollable |
Makes a <pre> element scrollable |
Referensi Tipografi Bootstrap Lengkap
Untuk referensi lengkap semua elemen/kelas tipografi, buka Referensi Tipografi Bootstrap lengkap kami .
Lihat juga Referensi Kelas Pembantu Bootstrap kami untuk informasi lebih lanjut tentang kelas kontekstual.