---
title: "How do you use Bootstrap's utility classes to quickly add small, reusable styles to HTML elements?"  
description: "How do you use Bootstrap's utility classes to quickly add small, reusable styles to HTML elements?"  
author: "Revati S Misra"  
published: 2023-05-12  
updated: 2023-05-13  
canonical: https://www.mindstick.com/forum/158316/how-do-you-use-bootstrap-s-utility-classes-to-quickly-add-small-reusable-styles-to-html-elements  
category: "bootstrap"  
tags: ["bootstrap", "bootstrap 5"]  
reading_time: 2 minutes  

---

# How do you use Bootstrap's utility classes to quickly add small, reusable styles to HTML elements?

How do you use [Bootstrap](https://www.mindstick.com/articles/1555/image-viewer-using-bootstrap-carousel)'s [utility classes](https://www.mindstick.com/forum/157967/what-are-some-of-the-new-utility-classes-and-functions-introduced-in-bootstrap-5) to quickly [add](https://www.mindstick.com/forum/12983/add-address-in-textbox-when-page-is-load-and-if-i-search-address-in-textbox-show-in-map-by-javascript) small, reusable styles to [HTML elements](https://www.mindstick.com/forum/158688/how-can-you-dynamically-create-html-elements-using-jquery)?

## Replies

### Reply by Aryan Kumar

Bootstrap's [utility](https://www.mindstick.com/articles/12979/the-utility-of-accounting-tools-for-businesses-and-organizations) classes are a great way to quickly add small, reusable styles to [HTML](https://www.mindstick.com/articles/1530/design-a-simple-stylish-calculator-using-html-css-and-javascript) [elements](https://www.mindstick.com/forum/1440/wpf-button-with-multiple-text-elements). They are available for a wide range of properties, including margins, padding, borders, colors, and more. To use a utility class, simply add it to the HTML element you want to style. For example, to add a 10px margin to the top and bottom of an element, you would add the class mt-10 mb-10 to the element.

Bootstrap's utility classes are also responsive, so they will automatically adjust their appearance depending on the size of the screen. This makes them ideal for creating websites and web applications that look great on all devices.

Here are some examples of how to use Bootstrap's utility classes:

- To add a 10px margin to the top and bottom of an element, use the class mt-10 mb-10.
- To add a 10px border around an element, use the class border-10.
- To change the background color of an element, use the class bg-color.
- To change the font color of an element, use the class text-color.

For a complete list of Bootstrap's utility classes, please see the Bootstrap documentation.

Here are some additional tips for using Bootstrap's utility classes:

- Use the d-* classes to control the display of an element. For example, the class d-block will display an element as a block, while the class d-none will hide the element.
- Use the align-* classes to align an element. For example, the class align-items-center will center an element vertically, while the class justify-content-center will center an element horizontally.
- Use the flex class to make an element flexbox. This will allow you to control the layout of the element using the flex-direction, flex-wrap, justify-content, and align-items properties.

Bootstrap's utility classes are a powerful tool that can help you quickly and easily style your HTML elements. With a little practice, you'll be able to create beautiful and responsive websites and web applications in no time.


---

Original Source: https://www.mindstick.com/forum/158316/how-do-you-use-bootstrap-s-utility-classes-to-quickly-add-small-reusable-styles-to-html-elements

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
