Borders in bootstrap with examples
Borders: Borders are generally used to display an outline around a box or table cell or any other HTML element. In Bootstrap, there are different classes available to add or remove borders. The classes that are used to add borders are referred as Additive classes and those that are used to remove borders are referred as subtractive classes.
Additive Border Classes:
- .border : This class adds a border all around the element.
- .border-top : This class adds a border on the top edge of the element.
- .border-left : This class adds a border on the left edge of the element.
- .border-right : This class adds a border on the right of the element.
- .border-bottom : This class adds a border on the bottom of the element.
Subtractive Border Classes:
- .border-0 : This class removes border from all around the element if exists.
- .border-top-0 : This class removes the border from the top edge of the element if exists.
- .border-left-0 : This class removes the border from the left edge of the element if exists.
- .border-right-0 : This class removes the border from the right of the element if exists.
- .border-bottom-0 : This class removes the border from the bottom of the element if exists.
Below program uses all of the additive and subtractive classes to add and remove borders:
Color of Borders
Any colour can be added to the border by using the following border-color classes that are available in bootstrap. If you want any other customized color, then you can set it manually using the CSS attribute.
Radius of Borders: Border radius is used to make the corner of border curved. More the radius, more curved and round it will be.
In bootstrap, the following classes as used in the code are used to implement radius at particular corners.
- Google Chrome
- Internet Explorer