<div class="btn first">
Кнопка
</div>
<div class="btn second">
<div class="text">Кнопка два</div>
</div>
.text {
position: relative;
z-index: 2;
}
.btn {
display: inline-block;
padding: 10px 15px;
color: #fff;
cursor: pointer;
overflow: hidden;
transition: 0.35s;
}
.btn.first {
background-color: red;
}
.btn.second {
background-color: green;
position: relative;
}
.btn.first:hover {
background-color: yellow;
color: #000;
}
.btn.second:after {
content: '';
width: 100%;
height: 100%;
background-color: blue;
position: absolute;
top: 0;
left: 0;
transform: translateX(100%);
transition: 0.35s;
}
.btn.second:hover:after {
transform: translateX(0);
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.