Bootstrap Sizing Utilities Tutorial with Examples

View more Tutorials:

Websites to learn foreign languages for free:
Follow us on our fanpages to receive notifications every time there are new articles. Facebook Twitter

1- Bootstrap Sizing

Bootstrap Sizing is a utility of Bootstrap, which provides several classes to help you set up the width and height of an element.
Class .w-*
w-25Equivalent to using Css {width: 25%}.
w-50Equivalent to using  Css {width: 50%}.
w-75Equivalent to using  Css {width: 75%}.
w-100Equivalent to using  Css {width: 100%}.
w-autoEquivalent to using​​​​​​​  Css {width: auto}.

<div class="border p-1">

   <div class="w-25 p-3 bg-primary">Width 25%</div>
   <div class="w-50 p-3 bg-secondary">Width 50%</div>
   <div class="w-75 p-3 bg-info">Width 75%</div>
   <div class="w-100 p-3 bg-danger">Width 100%</div>
   <div class="w-auto p-3 bg-success">Width auto</div>

Class .h-*
h-25Equivalent to using  Css {height: 25%}.
h-50Equivalent to using  Css {height: 50%}.
h-75Equivalent to using  Css {height: 75%}.
h-100Equivalent to using  Css {height: 100%}.
h-autoEquivalent to using  Css {height: auto}.

<div class="border p-1 mt-3" style="height:155px;">
   <div class="h-25 bg-primary" style="display:inline-block; width: 55px;">
   <div class="h-50 bg-secondary" style="display:inline-block; width: 55px;">
   <div class="h-75 bg-info" style="display:inline-block; width: 55px;">
   <div class="h-100 bg-danger" style="display:inline-block; width: 55px;">
   <div class="h-auto bg-success" style="display:inline-block; width: 70px;">
.mw-100, .mh-100
mw-100Equivalent to using  Css {max-width: 100%}.
mh-100Equivalent to using​​​​​​​  Css {max-height: 100%}.

<h4>Image with max-width:100%</h4>

<img class="mw-100" src="../images/flower.jpeg" alt="Max width 100%">

View more Tutorials: