I am quite confused by the peculiar behavior of min-content in CSS. Let me share a concise example demonstrating this issue using Tailwind.
<script src="https://cdn.tailwindcss.com"></script>
<div class="h-screen w-screen">
<p class="h-full w-min border-4">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Feugiat nibh sed pulvinar proin gravida. Et malesuada fames ac turpis egestas sed tempus urna et. Elementum nisi quis eleifend quam adipiscing vitae proin sagittis. Sodales neque sodales ut etiam. Ut venenatis tellus in metus vulputate eu. Mauris vitae ultricies leo integer malesuada nunc vel risus commodo. Massa id neque aliquam vestibulum morbi. Fames ac turpis egestas maecenas. Volutpat ac tincidunt vitae semper quis lectus nulla at. Tempor commodo ullamcorper a lacus vestibulum. Neque convallis a cras semper auctor neque vitae tempus.
</p>
</div>
Expected behavior: The p element should automatically adjust its width to prevent vertical overflow. However, it is not happening as expected; the text overflows due to insufficient width. What could be the reason behind this unexpected behavior?
Edit: Initially, I aimed to occupy maximum vertical space with the text without overflowing and adjusting the horizontal size accordingly. Perhaps using flexbox or other layout techniques might help achieve this goal instead of relying on min-content, which seems to be inadequate in this scenario.