Tekst Bootstrap /Typografia
Domyślne ustawienia Bootstrapa
Globalny domyślny rozmiar czcionki Bootstrap to 14px, a wysokość linii wynosi 1.428.
Dotyczy to <body>
elementu i wszystkich akapitów ( <p>
).
Ponadto wszystkie <p>
elementy mają dolny margines równy połowie obliczonej wysokości linii (domyślnie 10 pikseli).
Bootstrap a domyślne ustawienia przeglądarki
W tym rozdziale przyjrzymy się niektórym elementom HTML, które będą stylizowane nieco inaczej przez Bootstrap niż domyślne ustawienia przeglądarki.
<h1> - <h6>
Domyślnie Bootstrap stylizuje nagłówki HTML ( <h1>
do
<h6>
) w następujący sposób:
Przykład
h1 Bootstrap heading (36px)
h2 Bootstrap heading (30px)
h3 Bootstrap heading (24px)
h4 Bootstrap heading (18px)
h5 Bootstrap heading (14px)
h6 Bootstrap heading (12px)
<mały>
W Bootstrap <small>
element HTML służy do tworzenia jaśniejszego, drugorzędnego tekstu w dowolnym nagłówku:
Przykład
h1 heading secondary text
h2 heading secondary text
h3 heading secondary text
h4 heading secondary text
h5 heading secondary text
h6 heading secondary text
<oznaczenie>
Bootstrap stylizuje <mark>
element HTML w następujący sposób:
Przykład
Use the mark element to highlight text.
<skrót>
Bootstrap stylizuje <abbr>
element HTML w następujący sposób:
Przykład
The WHO was founded in 1948.
<cytat blokowy>
Bootstrap stylizuje <blockquote>
element HTML w następujący sposób:
Przykład
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.
Aby wyświetlić cytat po prawej, użyj .blockquote-reverse
klasy:
Przykład
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 stylizuje <dl>
element HTML w następujący sposób:
Przykład
- Coffee
- - black hot drink
- Milk
- - white cold drink
<kod>
Bootstrap stylizuje <code>
element HTML w następujący sposób:
Przykład
The following HTML elements: span
, section
, and div
defines a section in a document.
<kbd>
Bootstrap stylizuje <kbd>
element HTML w następujący sposób:
Przykład
Use ctrl + p to open the Print dialog box.
<pre>
Bootstrap stylizuje <pre>
element HTML w następujący sposób:
Przykład
Text in a pre element is displayed in a fixed-width font, and it preserves both spaces and line breaks.
Kontekstowe kolory i tła
Bootstrap ma również kilka klas kontekstowych, których można użyć, aby zapewnić „znaczenie poprzez kolory”.
Klasy kolorów tekstu to: .text-muted
,
.text-primary
, .text-success
, .text-info
,
.text-warning
i .text-danger
:
Przykład
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.
Klasy kolorów tła to: .bg-primary
,
.bg-success
, .bg-info
, .bg-warning
i .bg-danger
:
Przykład
This text is important.
This text indicates success.
This text represents some information.
This text represents a warning.
This text represents danger.
Więcej zajęć typografii
Poniższe klasy Bootstrap można dodać do dalszego stylu elementów HTML:
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 |
Pełne odniesienie do typografii Bootstrap
Aby uzyskać pełne odniesienie do wszystkich elementów/klas typografii, przejdź do naszego pełnego podręcznika typografii Bootstrap .
Zajrzyj również do naszego podręcznika klas pomocniczych Bootstrap , aby uzyskać więcej informacji na temat klas kontekstowych.