Testo/tipografia Bootstrap
Impostazioni predefinite di Bootstrap
La dimensione del carattere predefinita globale di Bootstrap è 14px, con un'altezza della linea di 1,428.
Viene applicato <body>
all'elemento ea tutti i paragrafi ( <p>
).
Inoltre, tutti <p>
gli elementi hanno un margine inferiore uguale alla metà dell'altezza della linea calcolata (10px per impostazione predefinita).
Bootstrap e impostazioni predefinite del browser
In questo capitolo, esamineremo alcuni elementi HTML che avranno uno stile leggermente diverso da Bootstrap rispetto alle impostazioni predefinite del browser.
<h1> - <h6>
Per impostazione predefinita, Bootstrap imposterà le intestazioni HTML ( <h1>
a
<h6>
) nel modo seguente:
Esempio
h1 Bootstrap heading (36px)
h2 Bootstrap heading (30px)
h3 Bootstrap heading (24px)
h4 Bootstrap heading (18px)
h5 Bootstrap heading (14px)
h6 Bootstrap heading (12px)
<piccolo>
In Bootstrap l' <small>
elemento HTML viene utilizzato per creare un testo secondario più leggero in qualsiasi intestazione:
Esempio
h1 heading secondary text
h2 heading secondary text
h3 heading secondary text
h4 heading secondary text
h5 heading secondary text
h6 heading secondary text
<segno>
Bootstrap modellerà l' <mark>
elemento HTML nel modo seguente:
Esempio
Use the mark element to highlight text.
<abbr>
Bootstrap modellerà l' <abbr>
elemento HTML nel modo seguente:
Esempio
The WHO was founded in 1948.
<citazione in blocco>
Bootstrap modellerà l' <blockquote>
elemento HTML nel modo seguente:
Esempio
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.
Per mostrare la citazione a destra, usa la .blockquote-reverse
classe:
Esempio
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 modellerà l' <dl>
elemento HTML nel modo seguente:
Esempio
- Coffee
- - black hot drink
- Milk
- - white cold drink
<codice>
Bootstrap modellerà l' <code>
elemento HTML nel modo seguente:
Esempio
The following HTML elements: span
, section
, and div
defines a section in a document.
<kbd>
Bootstrap modellerà l' <kbd>
elemento HTML nel modo seguente:
Esempio
Use ctrl + p to open the Print dialog box.
<precedente>
Bootstrap modellerà l' <pre>
elemento HTML nel modo seguente:
Esempio
Text in a pre element is displayed in a fixed-width font, and it preserves both spaces and line breaks.
Colori e sfondi contestuali
Bootstrap ha anche alcune classi contestuali che possono essere utilizzate per fornire "significato attraverso i colori".
Le classi per i colori del testo sono: .text-muted
,
.text-primary
, .text-success
, .text-info
,
.text-warning
e .text-danger
:
Esempio
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.
Le classi per i colori di sfondo sono: .bg-primary
,
.bg-success
, .bg-info
, .bg-warning
e .bg-danger
:
Esempio
This text is important.
This text indicates success.
This text represents some information.
This text represents a warning.
This text represents danger.
Altre lezioni di tipografia
Le classi Bootstrap seguenti possono essere aggiunte ulteriormente agli elementi HTML di stile:
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 |
Riferimento completo alla tipografia di Bootstrap
Per un riferimento completo di tutti gli elementi/classi di tipografia, vai al nostro completo Bootstrap Typography Reference .
Guarda anche la nostra Guida di riferimento alle classi di Bootstrap per ulteriori informazioni sulle classi contestuali.