I'm trying to prevent a parent division to be smaller than it's children using min-width and fit-content.
I first setup a division .parent with a min-width: fit-content. I, then added, a child with width: 100px and min-width: fit-content. Finaly, I added enough characters to the children to bust the 100px;
.parent {
border: 1px solid red;
width: fit-content;
}
.children {
border: 1px solid green;
min-width: fit-content;
width: 100px;
}
<div class="parent">
<div class="children">
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
</div>
</div>
DEMO: https://codepen.io/osasseville/pen/NadrgB?editors=1100
I would expect the parent to fit the content of the children, which fit the content of the characters.
Strangely, if I change the children's width to 1%, the min-width is respected.