サンプル
See the Pen Codepen by Tora (@webtoranomaki) on CodePen.
コード
<a class="btn btn01" href="#">Button</a>
.btn {
display: inline-block;
width: 200px;
height: 50px;
line-height: 50px;
text-align: center;
-webkit-transition: .3s;
transition: .3s;
}
.btn01 {
position: relative;
color: #fff;
border: 1px solid #333;
background-color: #333;
z-index: 2;
}
.btn01::before,
.btn01::after {
position: absolute;
display: block;
content: '';
left: 0;
width: 100%;
height: 50%;
background-color: #333;
z-index: -1;
-webkit-transition: .3s;
transition: .3s;
}
.btn01::before {
top: 0;
}
.btn01::after {
bottom: 0;
}
.btn01:hover {
border-color: #069;
background-color: #fff;
color: #069;
}
.btn01:hover::before,
.btn01:hover::after {
height: 0;
background-color: #069;
}