Boostrap: Add Border to Div in 3 Easy Steps

Ruth Jul 09, 2026

Looking to add a border to a div using Bootstrap? You're in the right place. Bootstrap, the popular CSS framework, offers a simple and efficient way to style your web elements, including adding borders to divs.

How To Center a div Horizontally in Bootstrap 4
How To Center a div Horizontally in Bootstrap 4

In this guide, we'll explore how to add borders to divs using Bootstrap, along with some useful tips and tricks to enhance your styling.

Bootstrap (Flexbox) is still better than CSS Grid for creating Layouts
Bootstrap (Flexbox) is still better than CSS Grid for creating Layouts

Adding a Border to a Div

Bootstrap provides a pre-defined set of border utilities that you can apply to any HTML element, including divs. These utilities are based on the border-width, border-style, and border-color properties of CSS.

Full-width Split Button Dropdown in Bootstrap
Full-width Split Button Dropdown in Bootstrap

To add a border to a div, you simply need to apply the appropriate border class to your div element. Here's a basic example:

```html

This div has a border.
```

Border Styles

CSS Inverted Border Radius Generator
CSS Inverted Border Radius Generator

Bootstrap offers five border styles: solid, dashed, dotted, dashed, and double. You can apply these styles using the border-style class variants. Here's how you can use them:

```html

Solid border.
Dashed border.
Dotted border.
Dashed border.
Double border.
```

Border Widths

Besides border styles, Bootstrap also provides border width variants. You can choose from extra small, small, medium, large, and extra large border widths. Here's how you can use them:

Bootstrap 5 Modal Form
Bootstrap 5 Modal Form

```html

Border with different widths.
```

Border Colors

Bootstrap includes a wide range of color utilities that you can use to style your borders. These colors include primary, secondary, success, danger, warning, info, light, and dark. Here's how you can use them:

```html

Primary color border.
Secondary color border.
Success color border.
Danger color border.
Warning color border.
Info color border.
Light color border.
Dark color border.
```

Border Radius

W3Schools.com
W3Schools.com

To add rounded corners to your bordered div, you can use the rounded class. Here's how you can use it:

```html

Rounded border.
```

Responsive Borders

How to Create Bootstrap 5 Navigation Header? – WebNots
How to Create Bootstrap 5 Navigation Header? – WebNots
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Layout is overrated
Layout is overrated
the text reads perfect border radus tips, but it's not for later
the text reads perfect border radus tips, but it's not for later
How to Use Bootstrap in HTML | Web Development
How to Use Bootstrap in HTML | Web Development
Best Free Bootstrap Login Forms » CSS Author
Best Free Bootstrap Login Forms » CSS Author
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap 3 grid system explained
Bootstrap 3 grid system explained
How to Add Deep Linking to the Bootstrap 4 Tabs Component | Envato Tuts+
How to Add Deep Linking to the Bootstrap 4 Tabs Component | Envato Tuts+
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap 4 Grid System
Bootstrap 4 Grid System
20+ Free Bootstrap UI Kits — Speckyboy
20+ Free Bootstrap UI Kits — Speckyboy
How To Add A Background Or Border To An Image Block In Squarespace
How To Add A Background Or Border To An Image Block In Squarespace
Examples
Examples
Border Radius Tips
Border Radius Tips
How To Add Section Borders To Your Squarespace Website To Create An Editorial Look
How To Add Section Borders To Your Squarespace Website To Create An Editorial Look
Bootstrap Tutorial For Beginners 4 - Creating Responsive Navbar with Dropdown Menus Part 1
Bootstrap Tutorial For Beginners 4 - Creating Responsive Navbar with Dropdown Menus Part 1
How to Make an Inverted border-radius in CSS (with diagrams)
How to Make an Inverted border-radius in CSS (with diagrams)
Create an inverted border using CSS clip-path
Create an inverted border using CSS clip-path
How to Build HTML Bootstrap Layouts With LayoutIt!
How to Build HTML Bootstrap Layouts With LayoutIt!

Bootstrap's border utilities are responsive by default. This means that the border style, width, and color will change based on the screen size. You can also create custom breakpoints for your borders using media queries.

In conclusion, adding a border to a div using Bootstrap is a straightforward process. With the wide range of border styles, widths, and colors available, you can create visually appealing divs that enhance your web design. So, start experimenting with borders today and take your web styling to the next level!