Boostrap: Add Border to Row

Ruth Jul 09, 2026

Adding a border to a row in Bootstrap can significantly enhance the visual appeal of your web page. It helps to separate sections, guide the eye, and improve overall readability. Here's a comprehensive guide on how to achieve this.

40+ Best Free Bootstrap Templates & Themes in 2026 — Speckyboy
40+ Best Free Bootstrap Templates & Themes in 2026 — Speckyboy

Before diving into the code, let's understand why borders are crucial in web design. They provide a subtle hint to users about the structure of the content, making your page more intuitive and user-friendly.

Bootstrap 5 Website Layout Design
Bootstrap 5 Website Layout Design

Understanding Bootstrap Rows

In Bootstrap, a row is a flexible container for your content. It allows you to create a horizontal grid system that can be easily adapted to different screen sizes. Understanding how rows work is the first step in adding a border to them.

Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5

Bootstrap uses a 12-column grid system. Each row is divided into 12 equal parts, and you can place your content into these columns as needed.

Basic Structure of a Row

the different types of font and numbers
the different types of font and numbers

The basic structure of a row in Bootstrap is simple. It starts with the <div> tag with the class "row". Here's an example:

<div class="row"> ... </div>

Adding Content to a Row

Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5

To add content to a row, you use the <div> tag with the class "col-x", where "x" is the number of columns you want the content to span. For example, <div class="col-6"> will span 6 columns, or half of the row.

Here's an example of a row with two columns of equal width:

<div class="row"> <div class="col-6"> ... </div> <div class="col-6"> ... </div> </div>

Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5

Adding a Border to a Row

Now that we understand the basics of rows in Bootstrap, let's look at how to add a border to one. The easiest way to do this is by using the built-in border utilities provided by Bootstrap.

W3Schools.com
W3Schools.com
the color chart for different colors and font options in an iphone phone screen, including blue, red, yellow, green, black, white
the color chart for different colors and font options in an iphone phone screen, including blue, red, yellow, green, black, white
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap 5 Modal Form
Bootstrap 5 Modal Form
a pink and blue timetable with lines on it
a pink and blue timetable with lines on it
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
Bootstrap 3 grid system explained
Bootstrap 3 grid system explained
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Layout is overrated
Layout is overrated
Bootstrap 4 Grid System
Bootstrap 4 Grid System
Bootstrap Tutorial – Introduction
Bootstrap Tutorial – Introduction
100+ Free Bootstrap 5 Templates » CSS Author
100+ Free Bootstrap 5 Templates » CSS Author
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Full-width Split Button Dropdown in Bootstrap
Full-width Split Button Dropdown in Bootstrap
Examples
Examples
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+
Best Free Bootstrap Login Forms » CSS Author
Best Free Bootstrap Login Forms » CSS Author
Bootstrap 3 Navbars - a Collection by  Jay Holtslander on CodePen
Bootstrap 3 Navbars - a Collection by Jay Holtslander on CodePen
two rows of numbers are shown with the same number on each row and the first row is
two rows of numbers are shown with the same number on each row and the first row is

Bootstrap offers several border styles, widths, and colors. You can apply these to your row by adding the appropriate class to the <div> tag with the "row" class.

Using Border Styles

To add a border to your row, you can use the "border" class along with one of the border style classes, such as "border-primary", "border-secondary", etc. Here's an example:

<div class="row border border-primary"> ... </div>

Using Border Widths

If you want to change the width of the border, you can use one of the border width classes, such as "border-1", "border-2", "border-3", "border-4", "border-5". Here's an example:

<div class="row border border-primary border-5"> ... </div>

Remember, the border will only appear on the top and bottom of the row by default. If you want a border on the left and right sides as well, you'll need to add some custom CSS.

Responsive Borders

Bootstrap is designed to be responsive, meaning it adjusts the layout of your page to fit different screen sizes. However, the border styles are not automatically responsive. If you want the border to change based on the screen size, you'll need to use media queries in your custom CSS.

Here's an example of how you might make the border disappear on small screens:

<style> @media (max-width: 575px) { .row.border { border: none; } } </style>

This concludes our guide on adding a border to a row in Bootstrap. With these techniques, you can enhance the visual appeal of your web pages and make them more intuitive for users.

Now that you've mastered adding borders to rows, why not explore other Bootstrap utilities to further customize your web design? The possibilities are endless!