Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to make flexbox sibling shrink to prevent text wrap

Using Tailwind, I have a div and two children that are flexbox. When the screen size gets small, the first child doesn’t shrink to give its sibling room. How do I fix this?

When I add flex-shrink-0 to the second child it overflows.

https://play.tailwindcss.com/UmXXkuJqk3?size=364×720

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You are facing this because of the input tag as by default input tags have minimum width of 100%.

To overcome this add w-full class inside the input tag.

Code: tailwind-play


Output (Before)

enter image description here

Output (After)

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading