In the below example the child width grows with smooth transition, but the parent width is abruptly changed!
I want both the child width and parent width transition smoothly.
*note the parent has max-width specified, but rest it controlled by the content, which is the child.
I tried adding transition ease property to the parent div, and expecting that the width change due to the child will smoothly transition here as well.
please check https://codepen.io/abstrekt/pen/qBKdPZe
<div class="parent">
<div class="child">this is the child</div>
</div>
<style>
.parent {
padding: 8px;
display: inline-flex;
border: 2px solid red;
max-width: 300px;
transition: width 1s ease;
}
.child {
white-space: nowrap;
overflow: hidden;
border: 2px solid green;
transition: width 1s ease;
width: 20px;
}
.parent:hover>.child {
width: 100%
}
</style>
I've been looking around for answer, but not able to find one for my usecase.