Riferimento alle classi helper CSS di Bootstrap
Testo
Aggiungi significato attraverso i colori del testo con le classi seguenti. I collegamenti si scuriranno al passaggio del mouse:
Class | Description | Example |
---|---|---|
.text-muted | Text styled with class "text-muted" | |
.text-primary | Text styled with class "text-primary" | |
.text-success | Text styled with class "text-success" | |
.text-info | Text styled with class "text-info" | |
.text-warning | Text styled with class "text-warning" | |
.text-danger | Text styled with class "text-danger" |
Sfondo
Aggiungi significato attraverso i colori di sfondo con le classi seguenti. I collegamenti si scuriranno al passaggio del mouse proprio come le classi di testo:
Class | Description | Example |
---|---|---|
.bg-primary | Table cell is styled with class "bg-primary" | |
.bg-success | Table cell is styled with class "bg-success" | |
.bg-info | Table cell is styled with class "bg-info" | |
.bg-warning | Table cell is styled with class "bg-warning" | |
.bg-danger | Table cell is styled with class "bg-danger" |
Altro
Class | Description | Example |
---|---|---|
.pull-left | Floats an element to the left | |
.pull-right | Floats an element to the right | |
.center-block | Sets an element to display:block with margin-right:auto and margin-left:auto | |
.clearfix | Clears floats | |
.show | Forces an element to be shown (display:block) | |
.hidden | Forces an element to be hidden (display:none) | |
.invisible | Forces an element to be invisible (visibility:hidden). Will take up space on page even though it is invisible | |
.sr-only | Hides an element to all devices except screen readers | |
.sr-only-focusable | Combine with .sr-only to show the element again when it is focused (e.g. by a keyboard-only user) | |
.text-hide | Helps replace an element's text content with a background image | |
.close | Indicates a close icon | |
.caret | Indicates dropdown functionality (will reverse automatically in dropup menus) |
Utilità reattive
Queste classi vengono utilizzate per mostrare e/o nascondere il contenuto dal dispositivo tramite query multimediali.
Utilizza una o una combinazione delle classi disponibili per alternare il contenuto tra i punti di interruzione del viewport:
Classi | Dispositivi extra piccoli Telefoni (<768px) | Piccoli dispositivi Tablet (≥768px) | Dispositivi medi Desktop (≥992px) | Dispositivi di grandi dimensioni Desktop (≥1200px) |
---|---|---|---|---|
.visible-xs-* | Visibile | Nascosto | Nascosto | Nascosto |
.visibile-sm-* | Nascosto | Visibile | Nascosto | Nascosto |
.visibile-md-* | Nascosto | Nascosto | Visibile | Nascosto |
.visible-lg-* | Nascosto | Nascosto | Nascosto | Visibile |
.nascosto-xs | Nascosto | Visibile | Visibile | Visibile |
.nascosto-sm | Visibile | Nascosto | Visibile | Visibile |
.nascosto-md | Visibile | Visibile | Nascosto | Visibile |
.hidden-lg | Visibile | Visibile | Visibile | Nascosto |
Nascosto
Nascondi elementi in base alle dimensioni dello schermo:
Esempio
<h2>Example</h2>
<p>Resize this page to see how the text below changes:</p>
<h1 class="hidden-xs bg-danger">This text is hidden on an EXTRA SMALL screen.</h1>
<h1 class="hidden-sm bg-info">This text is hidden on a SMALL screen.</h1>
<h1 class="hidden-md bg-warning">This is text hidden on a MEDIUM screen.</h1>
<h1 class="hidden-lg bg-success">This is text hidden on a LARGE screen.</h1>
Risultato:
Example
Resize this page to see how the text below changes:
This text is hidden on an EXTRA SMALL screen.
This text is hidden on a SMALL screen.
This is text hidden on a MEDIUM screen.
This is text hidden on a LARGE screen.
A partire dalla v3.2.0, le .visible-*-*
classi per sono disponibili in tre varianti, una per ogni display
valore della proprietà CSS:
Gruppo di classi | Visualizzazione CSS |
---|---|
visibile-*-blocco | blocco di visualizzazione; |
.visibile-*-in linea | display: in linea; |
.visibile-*-blocco-inline | display: blocco in linea; |
sm
Ad esempio, per schermi piccoli ( ), le .visible-*-*
classi disponibili sono: .visible-sm-block
, .visible-sm-inline
, e .visible-sm-inline-block
.
Le classi .visible-xs
, .visible-sm
, .visible-md
e .visible-lg
sono obsolete a partire dalla v3.2.0 .
Esempio
<h2>Example</h2>
<p>Resize this page to see how the text below changes:</p>
<h1 class="visible-xs">This text is shown only on an EXTRA SMALL screen.</h1>
<h1 class="visible-sm">This text is shown only on a SMALL screen.</h1>
<h1 class="visible-md">This text is shown only on a MEDIUM screen.</h1>
<h1 class="visible-lg">This text is shown only on a LARGE screen.</h1>
Risultato:
Example
Resize this page to see how the text below changes: