What are the steps for implementing flex-grow?

While exploring the documentation and issues of Bootstrap v4 (here), I have not come across any indication of plans to support a property like `flex-grow`, which would allow for a layout as shown below:

<div class="d-flex">
      <div  class="flex-grow">
        I use all the space left
      </div>
      <div>
        I am a small text on the right
      </div>
</div>

This is the specific layout I hope to achieve:

The export button remains fixed on the right, while the navigation button expands to fill all available space, creating a clean appearance.

Is it currently feasible to create such a layout within Bootstrap? If not, is it advisable to attempt so? While CSS workarounds are possible, my goal is to find a straightforward solution utilizing only Bootstrap classes for consistency.

Answer ā„–1

Employ the .col class to easily apply flex-grow: 1;. You can find more information about it at this link:

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
  <div class="row">
    <div class="col">
      I utilize all available space
    </div>
    <div class="col-sm col-sm-auto">
      I am a small text on the right
    </div>
  </div>
</div>

Answer ā„–2

For those who have landed here from a search engine like Google (just like myself).

Bootstrap version 4.1 introduced new flex-grow and flex-shrink utilities, which can be used as detailed in the documentation:

.flex-{grow|shrink}-0
.flex-{grow|shrink}-1
.flex-sm-{grow|shrink}-0
.flex-sm-{grow|shrink}-1

Here's a simple example:

<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet" />

<div class="d-flex flex-row">
  <div class="d-flex flex-grow-1 text-white justify-content-center bg-danger">
    Grow 1
  </div>
  <div class="d-flex flex-grow-0 text-white justify-content-center bg-success">
    Grow 0
  </div>
  <div class="d-flex flex-grow-1 text-white justify-content-center bg-danger">
    Grow 1
  </div>
</div>

Answer ā„–3

After searching through the Bootstrap documentation, I discovered that there was no mention of a specific class for this purpose.

.flex-2 { flex-grow: 2 }

The use of col-auto can cause uneven distribution of space when dealing with multiple rows. This is where the magic of flex-grow comes into play.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Automatic Expansion Feature for HTML Tables

http://jsfiddle.net/bzL7p87k/ In my table, placeholders are filled with special words. However, what happens when I have more than 4 rows? For instance, if there are 21 placeholders for 21 rows? What I mean is this: I only have one row with a placeholder ...

Can a circular image be created with text positioned to its right?

Hey there, hope everyone is well. I'm attempting to achieve a layout similar to the one in this image: https://i.sstatic.net/Y6wa4.png The text should be positioned on the right side of the image, without a large white space separating them. ...

Display information based on the radio button chosen

I've set up a radio button with options for "no" and "yes", but neither is selected by default. Here's what I'm trying to achieve: If someone selects "no", nothing should happen. However, if they select "yes", then a message saying "hello w ...

Strange arrangement of items in navbar - Using BOOTSTRAP 4

I'm currently experimenting with BOOTSTRAP 4 and the navbar, but the output on my webpage doesn't match what I want to achieve. https://i.sstatic.net/FnGlv.png What I want to achieve is shown in the following link: https://i.sstatic.net/oelsv. ...

User Profile dropdown on a customized Bootstrap 4-beta.3 navbar

Having some trouble with Bootstrap 4 and my top navbar setup. The dropdown menu for the profile is extending off the screen to the right. Do I just need to adjust the margin-right settings or is there something else missing from the navbar class? <nav ...

Trigger the opening of a class or window upon pressing the button

Good evening, I'm attempting to create a functionality where pressing a specific button will open a window. However, I am unsure of how to achieve this using CSS classes. My initial thought was to add a new class in the CSS file and call it every ti ...

Customize the width and padding of your data tables

I have several tables with different padding and width settings. Previously, I had set these inline without any issues. However, now that I am using data tables, the inline styles are not working. If you need more information about Datatables, check out t ...

The default black border on the Material UI Modal disappears upon inspection after rendering

Thank you for sharing your thoughts on this topic. I am currently experimenting with the Material-UI Modal component. In the image below, you can see that there is always a black border displayed upon rendering. I have attempted to remove it using custom ...

Preventing text from wrapping in a TypeScript-generated form: Tips and tricks

Iā€™m currently working on a ReactJS project and my objective is simple: I want all three <FormItem> components to be displayed in a single line without wrapping. However, I am facing the following output: https://i.stack.imgur.com/mxiIE.png Within ...

Having some trouble with my React and MUI project - the button animation isn't functioning as expected when clicked

After implementing a Button from MUIv5, I noticed that the full animation only triggers when I hold down the button instead of with a simple click. Is there a way to fix this so that the animation fully plays with just a single click? Any help is apprecia ...

The close button within the modal is malfunctioning even with the implementation of the on() function

My "show more" button triggers the modal to pop up, but when I click on the X button in the top left corner, it doesn't close as expected. However, clicking outside of the box or pressing the "esc" key does work. I suspect that the issue lies with th ...

Grid of images as background using Bootstrap

Currently delving into the world of bootstrap and online tutorials, I have a desire to construct a webpage using solely images as the background. The goal is to create a mosaic-like effect with no borders or space between them. Despite experimenting with ...

What is the best way to align the text in the center of my h1 header?

Can anyone assist me with centering the contents of my h1 tag? h1{ width: 100%; vertical-align: middle; color: rgb(5, 5, 5); font-size:25px; letter-spacing: 0px; top: 0; text-align: left; padding: 10; }h1:after { content:' '; display: ...

Stop HTML elements from shifting position when content is modified using JavaScript

'use strict'; const countdown = () => { // create function to calculate time until launch in Days/Hours/Minutes/Seconds // time difference const countDate = new Date('May 25, 2024 00:00:00').getTime(); const now = new Date( ...

"Discrepancy in Alignment of Bootstrap's Dual Column Layout

Currently, I am in the process of designing a straightforward two-column layout. This layout will consist of one prominent image at the top followed by two columns underneath - one for images and the other for text. https://i.sstatic.net/sYphQ.png Howeve ...

Update the background image every minute with a smooth transition effect

I am currently in the process of developing a personal dashboard that requires dynamic background images to change every minute. To achieve this functionality, I have integrated the [Pixabay API][1] and formulated the following API request: https://pixaba ...

How can I make my Grid items in React and Material-UI occupy the entire horizontal space without wrapping to the next row?

I am currently utilizing Material-UI within a React 16.10 project. My goal is to create a table where the left column consists of an icon, while the right column displays a label and address stacked on top of each other. I want the items in the right colum ...

How can I enhance the appearance of the WordPress pagination numbers with a stylish border

Is there a way to apply a border around the WordPress pagination that starts from the first number and ends at the final number in the pagination sequence? The current structure of the WordPress pagination includes: <a class="prev page-numbers">< ...

A user-friendly JavaScript framework focused on manipulating the DOM using a module approach and aiming to mirror the ease of use found in jQuery

This is simply a training exercise. I have created a script for solving this using the resource (function(window) { function smp(selector) { return new smpObj(selector); } function smpObj(selector) { this.length = 0; i ...

"Utilizing jQuery to enable smooth scrolling of entire windows with every twist of the mouse, similar to the

Does anyone have tips on how to achieve a scrolling effect that covers 100% of the window, similar to what is seen on this website? My website currently has vertical scrolling, with each div set to 100% width and height. I have implemented an anchor syste ...