Bootstrap- Text/Typografie
Bootstrap-Standardeinstellungen
Die globale Standardschriftgröße von Bootstrap beträgt 14 Pixel bei einer Zeilenhöhe von 1,428.
Dies wird auf das <body>
Element und alle Absätze angewendet ( <p>
).
Außerdem haben alle <p>
Elemente einen unteren Rand, der der Hälfte ihrer berechneten Zeilenhöhe entspricht (standardmäßig 10 Pixel).
Bootstrap vs. Browser-Standardwerte
In diesem Kapitel werden wir uns einige HTML-Elemente ansehen, die von Bootstrap etwas anders gestaltet werden als die Standardeinstellungen des Browsers.
<h1> - <h6>
Standardmäßig gestaltet Bootstrap die HTML-Überschriften ( <h1>
bis
<h6>
) folgendermaßen:
Beispiel
h1 Bootstrap heading (36px)
h2 Bootstrap heading (30px)
h3 Bootstrap heading (24px)
h4 Bootstrap heading (18px)
h5 Bootstrap heading (14px)
h6 Bootstrap heading (12px)
<klein>
In Bootstrap wird das HTML <small>
-Element verwendet, um einen helleren Sekundärtext in jeder Überschrift zu erstellen:
Beispiel
h1 heading secondary text
h2 heading secondary text
h3 heading secondary text
h4 heading secondary text
h5 heading secondary text
h6 heading secondary text
<Markierung>
Bootstrap formatiert das HTML- <mark>
Element folgendermaßen:
Beispiel
Use the mark element to highlight text.
<Abk.>
Bootstrap formatiert das HTML- <abbr>
Element folgendermaßen:
Beispiel
The WHO was founded in 1948.
<Blockzitat>
Bootstrap formatiert das HTML- <blockquote>
Element folgendermaßen:
Beispiel
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.
Um das Zitat auf der rechten Seite anzuzeigen, verwenden Sie die .blockquote-reverse
Klasse:
Beispiel
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 formatiert das HTML- <dl>
Element folgendermaßen:
Beispiel
- Coffee
- - black hot drink
- Milk
- - white cold drink
<Code>
Bootstrap formatiert das HTML- <code>
Element folgendermaßen:
Beispiel
The following HTML elements: span
, section
, and div
defines a section in a document.
<kbd>
Bootstrap formatiert das HTML- <kbd>
Element folgendermaßen:
Beispiel
Use ctrl + p to open the Print dialog box.
<vor>
Bootstrap formatiert das HTML- <pre>
Element folgendermaßen:
Beispiel
Text in a pre element is displayed in a fixed-width font, and it preserves both spaces and line breaks.
Kontextbezogene Farben und Hintergründe
Bootstrap hat auch einige kontextabhängige Klassen, die verwendet werden können, um "Bedeutung durch Farben" bereitzustellen.
Die Klassen für Textfarben sind: .text-muted
,
.text-primary
, .text-success
, .text-info
,
.text-warning
, und .text-danger
:
Beispiel
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.
Die Klassen für Hintergrundfarben sind: .bg-primary
,
.bg-success
, .bg-info
, .bg-warning
, und .bg-danger
:
Beispiel
This text is important.
This text indicates success.
This text represents some information.
This text represents a warning.
This text represents danger.
Mehr Typografie-Klassen
Die folgenden Bootstrap-Klassen können hinzugefügt werden, um HTML-Elemente weiter zu stylen:
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 |
Vollständige Bootstrap-Typografie-Referenz
Eine vollständige Referenz aller Typografie-Elemente/Klassen finden Sie in unserer vollständigen Bootstrap-Typografie-Referenz .
Weitere Informationen zu kontextbezogenen Klassen finden Sie auch in unserer Bootstrap-Hilfsklassen-Referenz .