Width and Height Classes
You can set the width or height of an element as a percentage of its parent using simple classes.
| Class | Result |
|---|---|
w-25 | width: 25% |
w-50 | width: 50% |
w-75 | width: 75% |
w-100 | width: 100% |
w-auto | width: auto |
h-25 to h-100 | Same options for height (parent needs a height) |
Example
Three colored bars of different lengths: a quarter, half and the full width of their parent.
Height
Percentage heights only work when the parent element has a defined height.
Max Width and Max Height
Viewport Units
The viewport is the visible area of the browser window. Use these classes to size elements based on the screen itself:
| Class | Meaning |
|---|---|
vw-100 | 100% of the viewport width |
vh-100 | 100% of the viewport height |
min-vw-100 | Minimum width of the viewport width |
min-vh-100 | Minimum height of the viewport height |
This makes a hero section that exactly fills the screen, with the heading centered.
Responsive Images with Sizing
For images, img-fluid (a later lesson) is usually better than w-100, because it never makes the image bigger than its natural size.
Conclusion
Sizing utilities help you control element dimensions in a quick and readable way. For full screen sections, vh-100 is your best friend.

