A
A
aaltw2021-12-24 16:42:01
Bootstrap
aaltw, 2021-12-24 16:42:01

Why is flex-shrink-1 not working as expected?

There is such a panel:
61c5cc95f2bbd846233772.png
The right element has the class flex-shrink-1. Those. it will shrink when it reaches the left elements. This works, but the content of the left elements is also compressed, although it should not be:
61c5ce1ea34df725205554.png
Why is this so? Do they all need to set flex: none?

I thought that since the right flex-shrink-1, it means that it will shrink alone until it shrinks completely, and then the rest will shrink as usual. Code: https://codepen.io/aaltw/pen/vYeWNVY .

And a related question. There is a task to implement a similar menu (this is not navigation, a menu with function buttons, selects and other such) and there are 2 ways to do it:
https://getbootstrap.com/docs/5.0/utilities/flex/
https://getbootstrap. com/docs/5.0/layout/grid/

Which one is preferred and why?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Ankhena, 2021-12-24
@altw

I thought that since the right flex-shrink-1, it means that it will shrink alone until it shrinks completely, and then the rest will shrink as usual.

If the rest had 0, then something like this would have happened. But only they would not shrink below the minimum width, if specified.
But they also have 1.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question