How to Use Bootstrap Width Classes

Bootstrap Width Classes

Learn bootstrap width classes with example codes. This class is used to set the width of a text. There are different types of width classes are available in Bootstrap. “w” indicates width.

  • w-25: sets the width of an element to 25% of it parent width.
  • w-50: sets the width of an element to 50% of it parent width.
  • w-75: sets the width of an element to 75% of it parent width.
  • w-100: sets the width of an element to 100% of it parent width.

Example:

<div style="border: 1px solid black;">
   <div class="bg-primary w-25">Width 25%</div>
   <div class="bg-primary w-50">Width 50%</div>
   <div class="bg-primary w-75">Width 75%</div>
   <div class="bg-primary w-100">Width 100%</div>
</div>

Output:

bootstrap width classes

Leave a Reply