Bootstrap 4 Class Reference

Welcome to the Bootstrap 4 Class Reference by The Coding College! This comprehensive guide lists commonly used Bootstrap 4 classes, organized by category, to help you quickly find the right class for your project. Use this reference to streamline your workflow and build responsive, modern web designs efficiently.

1. Layout Classes

Grid System

Bootstrap’s grid system is based on a 12-column layout. Use these classes to structure layouts.

Class NameDescription
.containerCreates a fixed-width container.
.container-fluidCreates a full-width, responsive container.
.rowDefines a row for columns.
.col-*Defines columns (* can be numbers 1–12).
.col-sm-*Columns for small devices (≥576px).
.col-md-*Columns for medium devices (≥768px).
.col-lg-*Columns for large devices (≥992px).
.col-xl-*Columns for extra-large devices (≥1200px).
.offset-*Adds space to the left of a column.
.order-*Changes the order of columns.

Display Utilities

Control the visibility of elements based on screen size.

Class NameDescription
.d-noneHides an element.
.d-blockDisplays as a block element.
.d-inlineDisplays as an inline element.
.d-inline-blockDisplays as an inline-block element.
.d-flexDisplays as a flex container.
.d-sm-* to .d-xl-*Responsive display utilities.

Flexbox Utilities

Simplify layout alignment with Bootstrap’s flexbox utilities.

Class NameDescription
.d-flexEnables flexbox.
.justify-content-startAligns flex items to the left.
.justify-content-endAligns flex items to the right.
.justify-content-centerAligns flex items to the center.
.align-items-startAligns items to the top.
.align-items-centerCenters items vertically.
.align-items-endAligns items to the bottom.

2. Typography Classes

Class NameDescription
.text-leftAligns text to the left.
.text-centerAligns text to the center.
.text-rightAligns text to the right.
.text-mutedAdds muted, grey-colored text.
.text-uppercaseTransforms text to uppercase.
.text-lowercaseTransforms text to lowercase.
.font-weight-boldMakes text bold.
.font-weight-lightMakes text lighter.
.font-italicApplies italic styling.

3. Buttons

Class NameDescription
.btnBase button styling.
.btn-primaryBlue button (default theme).
.btn-secondaryGrey button.
.btn-successGreen button.
.btn-dangerRed button.
.btn-warningYellow button.
.btn-infoLight blue button.
.btn-lightLight button with subtle styling.
.btn-darkDark button.
.btn-outline-*Outline buttons for all color variants.

4. Forms and Inputs

Form Layout

Class NameDescription
.form-controlApplies default input styling.
.form-inlineCreates inline forms.
.form-groupGroups form elements.

Input Styles

Class NameDescription
.form-control-smSmall-sized input.
.form-control-lgLarge-sized input.
.input-groupGroups inputs with addons or buttons.

5. Components

Navigation

Class NameDescription
.navbarCreates a navigation bar.
.navbar-lightLight-colored navbar.
.navbar-darkDark-colored navbar.
.navbar-expand-*Expands navbar based on screen size.

Alerts

Class NameDescription
.alertBase class for alerts.
.alert-primaryBlue alert.
.alert-successGreen alert.
.alert-dangerRed alert.
.alert-warningYellow alert.

Cards

Class NameDescription
.cardCreates a card container.
.card-headerAdds a header section to the card.
.card-bodyAdds content to the card body.
.card-footerAdds a footer section to the card.

Modal

Class NameDescription
.modalBase modal styling.
.modal-dialogDefines the modal’s dialog box.
.modal-contentContainer for modal content.

6. Spacing Utilities

Class NameDescription
.m-0 to .m-5Margin utilities (0 to 5).
.p-0 to .p-5Padding utilities (0 to 5).
.mt-*, .mb-*, .ml-*, .mr-*Top, bottom, left, right margin.
.pt-*, .pb-*, .pl-*, .pr-*Top, bottom, left, right padding.

7. Colors

Class NameDescription
.text-primaryBlue text.
.text-successGreen text.
.text-dangerRed text.
.text-warningYellow text.
.bg-primaryBlue background.
.bg-successGreen background.
.bg-dangerRed background.
.bg-warningYellow background.

8. Advanced Classes

Class NameDescription
.sticky-topMakes an element sticky at the top of the viewport.
.roundedAdds rounded corners to elements.
.shadowAdds a shadow to an element.
.sr-onlyHides an element visually but keeps it accessible for screen readers.

Conclusion

This Bootstrap 4 Class Reference is designed to be a handy cheat sheet for developers using Bootstrap. For more detailed guides and tutorials, visit The Coding College. With these classes, you can build responsive, modern, and visually appealing websites quickly and efficiently!

Leave a Comment