Boostrap: Add Border to Form Elements

Ruth Jul 09, 2026

Adding borders to forms in Bootstrap can significantly enhance their visual appeal and usability. Bootstrap, a popular CSS framework, offers several classes that allow you to easily style form elements, including borders. Let's delve into how you can add borders to forms using Bootstrap.

37 Free Bootstrap Form Templates You Can Try Right Now
37 Free Bootstrap Form Templates You Can Try Right Now

Before we dive into the specifics, ensure you have included the Bootstrap CSS library in your project. You can do this by adding the following line in the section of your HTML file:

BOOTSTRAP INPUT FORM (2020) | HOW TO MAKE FORM IN BOOTSTRAP
BOOTSTRAP INPUT FORM (2020) | HOW TO MAKE FORM IN BOOTSTRAP

```html ```

Adding Borders to Form Elements

Bootstrap provides the `.border` class to add a border to an element. You can use this class along with other border-related classes to customize the border style, width, and color.

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

Here's a simple example of adding a border to a form element using the `.border` class:

```html

We'll never share your email with anyone else.
```

Customizing Border Style

Bootstrap Tutorial – Introduction
Bootstrap Tutorial – Introduction

You can customize the border style using the `.border-{style}` classes. Bootstrap supports several border styles, including `primary`, `secondary`, `success`, `danger`, `warning`, `info`, `light`, and `dark`. Here's an example using the `danger` style:

```html

```

Customizing Border Width

To change the border width, you can use the `.border-{width}` classes. The available widths are `1`, `2`, `3`, and `4`. Here's an example using the `3` width:

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

```html

```

Adding Borders to Form Groups

You can also add borders to entire form groups using the `.form-floating` class. This class adds a border to the input field and the label, creating a more integrated look.

Here's an example:

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

```html

```

Adding borders to forms in Bootstrap is a breeze. With just a few classes, you can significantly enhance the visual appeal of your forms. Experiment with different border styles, widths, and form group layouts to create forms that are both functional and aesthetically pleasing. Happy coding!

W3Schools.com
W3Schools.com
Dual Design Registration Form
Dual Design Registration Form
the css borderr radus menu
the css borderr radus menu
42 Best Free HTML5 And CSS3 Login Forms 2026 - Colorlib
42 Best Free HTML5 And CSS3 Login Forms 2026 - Colorlib
a black and white border with barbed wire
a black and white border with barbed wire
the bootstrap 4 what's new logo on a purple and white background
the bootstrap 4 what's new logo on a purple and white background
Free 22+ HTML5 Signup & Registration Forms - HTML, CSS
Free 22+ HTML5 Signup & Registration Forms - HTML, CSS
40 Best Free Bootstrap Login Form Templates 2026 - Colorlib
40 Best Free Bootstrap Login Form Templates 2026 - Colorlib
a screenshot of the external ui kit, which includes several options for each user to use
a screenshot of the external ui kit, which includes several options for each user to use
Bootstrap 4 Cheat Sheet - The ultimate list of Bootstrap classes
Bootstrap 4 Cheat Sheet - The ultimate list of Bootstrap classes
three different screens showing how to use the new form screen and right form drawer
three different screens showing how to use the new form screen and right form drawer
Bootstrap Login by Egotype | Creative Market
Bootstrap Login by Egotype | Creative Market
How To Add Borders in Elementor WordPress Plugin? Tutorial
How To Add Borders in Elementor WordPress Plugin? Tutorial
Bootstrap Media Queries and How to use it?
Bootstrap Media Queries and How to use it?
#CSS Animations Tips and Tricks
#CSS Animations Tips and Tricks
25+ Best Free Bootstrap Admin Dashboard Templates — Speckyboy
25+ Best Free Bootstrap Admin Dashboard Templates — Speckyboy
How to Put Decorative or Pretty Border Frame on Google Docs
How to Put Decorative or Pretty Border Frame on Google Docs
Pink Blossom Floral Border🌸✨
Pink Blossom Floral Border🌸✨
Concrete Paver Garden Border Ideas
Concrete Paver Garden Border Ideas
How to Use Bootstrap to Build Website
How to Use Bootstrap to Build Website