Bootstrap Text/Typography
Výchozí nastavení bootstrapu
Globální výchozí velikost písma Bootstrapu je 14 pixelů s výškou řádku 1,428.
To se vztahuje na <body>
prvek a všechny odstavce ( <p>
).
Kromě toho mají všechny <p>
prvky spodní okraj, který se rovná polovině jejich vypočítané výšky řádku (ve výchozím nastavení 10 pixelů).
Bootstrap vs. výchozí nastavení prohlížeče
V této kapitole se podíváme na některé HTML prvky, které budou mít Bootstrap trochu jiný styl než výchozí nastavení prohlížeče.
<h1> - <h6>
Ve výchozím nastavení Bootstrap stylizuje záhlaví HTML ( <h1>
do
<h6>
) následujícím způsobem:
Příklad
h1 Bootstrap heading (36px)
h2 Bootstrap heading (30px)
h3 Bootstrap heading (24px)
h4 Bootstrap heading (18px)
h5 Bootstrap heading (14px)
h6 Bootstrap heading (12px)
<malé>
V Bootstrap se <small>
element HTML používá k vytvoření světlejšího sekundárního textu v libovolném nadpisu:
Příklad
h1 heading secondary text
h2 heading secondary text
h3 heading secondary text
h4 heading secondary text
h5 heading secondary text
h6 heading secondary text
<mark>
Bootstrap stylizuje <mark>
prvek HTML následujícím způsobem:
Příklad
Use the mark element to highlight text.
<zkratka>
Bootstrap stylizuje <abbr>
prvek HTML následujícím způsobem:
Příklad
The WHO was founded in 1948.
<blockquote>
Bootstrap stylizuje <blockquote>
prvek HTML následujícím způsobem:
Příklad
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.
Chcete-li zobrazit nabídku vpravo, použijte .blockquote-reverse
třídu:
Příklad
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>
prvek HTML následujícím způsobem:
Příklad
- Coffee
- - black hot drink
- Milk
- - white cold drink
<kód>
Bootstrap stylizuje <code>
prvek HTML následujícím způsobem:
Příklad
The following HTML elements: span
, section
, and div
defines a section in a document.
<kbd>
Bootstrap stylizuje <kbd>
prvek HTML následujícím způsobem:
Příklad
Use ctrl + p to open the Print dialog box.
<před>
Bootstrap stylizuje <pre>
prvek HTML následujícím způsobem:
Příklad
Text in a pre element is displayed in a fixed-width font, and it preserves both spaces and line breaks.
Kontextové barvy a pozadí
Bootstrap má také některé kontextové třídy, které lze použít k poskytnutí „významu prostřednictvím barev“.
Třídy pro barvy textu jsou: .text-muted
,
.text-primary
, .text-success
, .text-info
,
.text-warning
a .text-danger
:
Příklad
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.
Třídy pro barvy pozadí jsou: .bg-primary
,
.bg-success
, .bg-info
, .bg-warning
a .bg-danger
:
Příklad
This text is important.
This text indicates success.
This text represents some information.
This text represents a warning.
This text represents danger.
Více kurzů typografie
Třídy Bootstrap níže lze přidat k prvkům HTML stylu dále:
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 |
Kompletní referenční typografie bootstrapu
Úplnou referenci všech typografických prvků/tříd najdete v naší kompletní referenční typografii Bootstrap .
Další informace o kontextových třídách naleznete také v naší Referenční příručce pomocných tříd Bootstrap .