Начальный текст/типографика
Настройки Bootstrap по умолчанию
Глобальный размер шрифта Bootstrap по умолчанию составляет 14 пикселей с высотой строки 1,428.
Это применяется к <body>
элементу и ко всем абзацам ( <p>
).
Кроме того, все <p>
элементы имеют нижнее поле, равное половине вычисленной высоты строки (по умолчанию 10 пикселей).
Bootstrap и настройки браузера по умолчанию
В этой главе мы рассмотрим некоторые HTML-элементы, стиль которых в Bootstrap немного отличается от стиля браузера по умолчанию.
<h1> - <h6>
По умолчанию Bootstrap стилизует заголовки HTML ( <h1>
to
<h6>
) следующим образом:
Пример
h1 Bootstrap heading (36px)
h2 Bootstrap heading (30px)
h3 Bootstrap heading (24px)
h4 Bootstrap heading (18px)
h5 Bootstrap heading (14px)
h6 Bootstrap heading (12px)
<маленький>
В Bootstrap элемент 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 стилизует <mark>
элемент HTML следующим образом:
Пример
Use the mark element to highlight text.
<сокращение>
Bootstrap стилизует <abbr>
элемент HTML следующим образом:
Пример
The WHO was founded in 1948.
<цитата>
Bootstrap стилизует <blockquote>
элемент HTML следующим образом:
Пример
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.
Чтобы показать цитату справа, используйте .blockquote-reverse
класс:
Пример
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.
<дл>
Bootstrap стилизует <dl>
элемент HTML следующим образом:
Пример
- Coffee
- - black hot drink
- Milk
- - white cold drink
<код>
Bootstrap стилизует <code>
элемент HTML следующим образом:
Пример
The following HTML elements: span
, section
, and div
defines a section in a document.
<kbd>
Bootstrap стилизует <kbd>
элемент HTML следующим образом:
Пример
Use ctrl + p to open the Print dialog box.
<пред>
Bootstrap стилизует <pre>
элемент HTML следующим образом:
Пример
Text in a pre element is displayed in a fixed-width font, and it preserves both spaces and line breaks.
Контекстные цвета и фоны
В Bootstrap также есть несколько контекстных классов, которые можно использовать для предоставления «значения через цвета».
Классы для цветов текста: .text-muted
,
.text-primary
, .text-success
, .text-info
,
.text-warning
, и .text-danger
:
Пример
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.
Классы для цветов фона: .bg-primary
,
.bg-success
, .bg-info
, .bg-warning
и .bg-danger
:
Пример
This text is important.
This text indicates success.
This text represents some information.
This text represents a warning.
This text represents danger.
Дополнительные занятия по типографике
Приведенные ниже классы Bootstrap можно добавить к стилю 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 |
Полный справочник по типографике Bootstrap
Полный справочник по всем элементам/классам типографики см. в нашем полном справочнике по типографике Bootstrap .
Также посмотрите наш Справочник по вспомогательным классам Bootstrap для получения дополнительной информации о контекстных классах.