VOOZH about

URL: https://www.geeksforgeeks.org/bootstrap/bootstarp-5-grid-system-setting-one-column-width/

⇱ BootStrap 5 Grid system Setting one column width - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

BootStrap 5 Grid system Setting one column width

Last Updated : 5 Jan, 2023

Bootstrap 5 Grid system Setting one column width is used to set the width of a specific column, it can be applied to any column. The Auto-layout for flexbox grid columns means you can set the width of one column and the sibling columns will automatically resize around it.

Bootstrap 5 Grid system Setting one column width Class: There is no specific class for this, you .an use the col-& classes to set the width.

Syntax:

<div class="row">
 <div class="col">
 ...
 </div>
 <div class="col-6">
 ...
 </div>
 <div class="col">
 ...
 </div>
</div>

Example 1: The code in the example shows how setting only the center column's width leads the other columns to resize themselves accordingly.

Output:

👁 Image
 

Example 2: The code in the example shows how setting only the center column's width inside even Nested Grid also leads the other columns to resize themselves accordingly:

Output:

👁 Image
 

Reference:https://getbootstrap.com/docs/5.0/layout/grid/#setting-one-column-width 

Comment
Article Tags:

Explore