VOOZH about

URL: https://www.geeksforgeeks.org/bootstrap/bootstrap-5-sizing/

⇱ Bootstrap 5 Sizing - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Bootstrap 5 Sizing

Last Updated : 4 Apr, 2024

Bootstrap 5 Sizing utility classes adjust element dimensions relative to the viewport or parent container. Options include percentage-based widths, and viewport-relative dimensions, facilitating responsive design for flexible layouts across various screen sizes.

Bootstrap 5 Sizing Classes

Class NameDescription
Relative to the ParentSets the height and width of the element relative to its parent.
Relative to the ViewportSets the height and width of the element relative to the viewport.
SassSass sizing utilities declared in the Utility API.

Syntax:

<div class="w-25">
 ...
</div> 

Examples of Bootstrap 5 Sizing

Example 1: In this example, we used the sizing classes relative to the parent to set the height and width of the element.

Output:

👁 BootstrapSizing-(1)
Bootstrap 5 Sizing Example Output

Example 2: In this example, we used the sizing classes relative to the viewport to set the height and width of an element.

Output:

👁 Image
Bootstrap 5 Sizing Example Output
Comment

Explore