Movatterモバイル変換


[0]ホーム

URL:


Menu
×
See More 
Sign In
+1 Get Certified Upgrade For Teachers Spaces Get Certified Upgrade For Teachers Spaces
   ❮     
     ❯   

BootstrapCSS Helper Classes Reference


Text

Add meaning through text-colors with the classes below. Links will darken on hover:

ClassDescriptionExample
.text-mutedText styled with class "text-muted"Try it
.text-primaryText styled with class "text-primary"Try it
.text-successText styled with class "text-success"Try it
.text-infoText styled with class "text-info"Try it
.text-warningText styled with class "text-warning"Try it
.text-dangerText styled with class "text-danger"Try it

Background

Add meaning through background-colors with the classes below. Links will darken on hover just like text classes:

ClassDescriptionExample
.bg-primaryTable cell is styled with class "bg-primary"Try it
.bg-successTable cell is styled with class "bg-success"Try it
.bg-infoTable cell is styled with class "bg-info"Try it
.bg-warningTable cell is styled with class "bg-warning"Try it
.bg-dangerTable cell is styled with class "bg-danger"Try it

Other

ClassDescriptionExample
.pull-leftFloats an element to the leftTry it
.pull-rightFloats an element to the rightTry it
.center-blockSets an element to display:block with margin-right:auto and margin-left:autoTry it
.clearfixClears floatsTry it
.showForces an element to be shown (display:block)Try it
.hiddenForces an element to be hidden (display:none)Try it
.invisibleForces an element to be invisible (visibility:hidden). Will take up space on page even though it is invisibleTry it
.sr-onlyHides an element to all devices except screen readersTry it
.sr-only-focusableCombine with .sr-only to show the element again when it is focused (e.g. by a keyboard-only user)Try it
.text-hideHelps replace an element's text content with a background imageTry it
.closeIndicates a close iconTry it
.caretIndicates dropdown functionality (will reverse automatically in dropup menus)Try it


Responsive Utilities

These classes are used to show and/or hide content by device via media queries.

Use one or a combination of the available classes for toggling content across viewport breakpoints:

Classes Extra small devicesPhones (<768px) Small devicesTablets (≥768px) Medium devicesDesktops (≥992px) Large devicesDesktops (≥1200px)
.visible-xs-*VisibleHiddenHiddenHidden
.visible-sm-*HiddenVisibleHiddenHidden
.visible-md-*HiddenHiddenVisibleHidden
.visible-lg-*HiddenHiddenHiddenVisible
.hidden-xsHiddenVisibleVisibleVisible
.hidden-smVisibleHiddenVisibleVisible
.hidden-mdVisibleVisibleHiddenVisible
.hidden-lgVisibleVisibleVisibleHidden

Hidden

Hide elements depending on screen size:

Example

<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>

Result:

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.


Try it Yourself »

As of v3.2.0, the.visible-*-* classes for come in three variations, one for each CSSdisplay property value:

Group of classesCSS display
visible-*-blockdisplay: block;
.visible-*-inlinedisplay: inline;
.visible-*-inline-blockdisplay: inline-block;

E.g. for small (sm) screens, the available.visible-*-* classes are:.visible-sm-block,.visible-sm-inline, and.visible-sm-inline-block.

The classes.visible-xs,.visible-sm,.visible-md, and.visible-lg aredeprecated as of v3.2.0.

Example

<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>

Result:

Example

Resize this page to see how the text below changes:

This text is shown only on an EXTRA SMALL screen.

This text is shown only on a SMALL screen.

This text is shown only on a MEDIUM screen.

This text is shown only on a LARGE screen.


Try it Yourself »


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning.
Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness
of all content. While using W3Schools, you agree to have read and accepted ourterms of use,cookies andprivacy policy.

Copyright 1999-2025 by Refsnes Data. All Rights Reserved.W3Schools is Powered by W3.CSS.


[8]ページ先頭

©2009-2025 Movatter.jp