How to Set Border for div Element in Bootstrap

Border div bootstrap

In this article, we will see about how to set border for div using bootstrap classes.

Step by step guide to set border for div

  1. Create HTML file and link the “bootstrap” file using <link> tag.
  2.  Create a <div> tag and set the classname “border border-primary d-inline p-1”.
  • border – creating border
  • border-primary – set border color
  • d-inline – set display property to inline, because div is block level element. If you don’t set this, the
  • div border will display at full width
  • p-1 – set padding.

Code:

<div class="d-inline border border-primary">
  TEXT
</div>

Output:

border div bootstrapIf you want to add dotted border, we need to add the classname “border-dotted

Leave a Reply