JSFiddle - React, Tailwind, and code Playground

by Dejan Munjiza

HTML

<div class="action-left">move left</div>
    <div class="action-right">move right</div>

<div class="wrapper">
    
    
    <div class="content">
        <div class="content-left">LEFT Ipsum Dplor</div>
        <div class="content-right">RIGHT Ipsum DOlor</div>
    </div>
</div>

CSS

.wrapper {
    width: 600px;
    height: 200px;
    margin: 0 auto;
    background: white;
    border: 1px solid gray;
    overflow: hidden;
}

.content {
    position: relative;
    display: block;
    width: 1000px;
    height: 100%;
    margin-left: -200px;
    margin-right: -200px;
    background: #eee;
}

.content-left {
    width: 200px;
    color: red;
    position: absolute;
    left: 0;
    top: 0;
}

.content-right {
    width: 200px;
    color: blue;
    position: absolute;
    right: 0;
    top: 0;
}

.action-left {
    position: absolute;
    top: 0;
    left: 0;
    padding: 5px;
    background: orange;
}

.action-left:hover .content {
    animation: moveLeft 5s ease;

}

@keyframes moveLeft {
    from { margin-left: -200px; }
    to {  margin-left: 0; }
}

.action-right {
    position: absolute;
    top: 0;
    right: 0;
    text-align: right;
    padding: 5px;
    background: orange;
}