JSFiddle - React, Tailwind, and code Playground

by danield770

HTML

<div class="container">
    <span class="child1">Fixed</span>
    <span class="child2">Dynamic Width</span>
</div>

<div class="container">
    <span class="child1">Fixed</span>
    <span class="child2">Here is a Dynamic Width box</span>
</div>

CSS

.container {
    width: 200px;
    height: 50px;
    border: 1px solid green;
    overflow: hidden;
    white-space: noWrap;
}
span {
   height: 50px;
   display: inline-block;
}

.child1 {
    background: aqua;
    float: right;
    width: 50px;
    margin-right: -50px;
    transition: margin .2s;
}
.container:hover .child1 {
    margin-right: 0;
}
.child2 {
   background: tomato;
   //width: 100%;  
}