<a href="#" class="button"><span>詳しく見る</span></a>
.button {
margin-bottom: 40px;
height: 50px;
width: 150px;
display: grid;
place-items: center;
color: #fff;
text-decoration: none;
background-color: #000;
position: relative;
transition: all 0.6s ease;
border: 1px solid #000;
overflow: hidden;
background-color: #000;
position: relative;
color: #fff;
&::before {
content: "";
height: 50px;
width: 150px;
display: block;
position: absolute;
transform: translateX(-100%);
background-color: #fff;
transition: all 0.3s ease;
}
span {
position: relative;
z-index: 1;
}
&:hover {
&::before {
transform: translateX(0);
}
span {
color: #000;
}
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.