shrinking one flexbox item when a second flexbox item expands?
تبليغيرجى شرح بإيجاز لمإذا تشعر أنك ينبغي الإبلاغ عن هذا السؤال.
I have the following HTML Div Elements:
.container
.item1
.item2
Both items are containers of other elements.
item1 Element has a button that expands it revealing more items.
item2 needs to shrink when item1 expands.
the following is a sketch of the usecase:
How can I achieve this using CSS flexbox?
In the sketch its a 1:2 ration, but really every time item1 expands it can be any ratio.
Sorry for not showing what I tried till now, I dont have the source code with me….
I did try using the flex-grow and flex-shrink but it didn’t really work for me…
Is there another way, to dynamically expand and shrink elements depending on sibling elements height?
CSS Grid solution can also work…
أضف إجابة