<div class="container">
<a class="btn-surround" href="#">
<span>PUSH ME</span>
</a>
</div>
/* ここはコピーしなくてOK */
.container {
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@700&display=swap');
font-family: 'Noto Sans JP', sans-serif;
text-align: center;
padding-top: 40px;
}
/* ここから下がボタンのCSS */
.btn-surround {
display: inline-block;
text-decoration: none;
color: #FFF;
font-weight: 700;
background-color: #65A04D;
text-align: center;
width: inherit;
min-width: 250px;
padding: 16px 16px;
position: relative;
opacity: 1 !important;
transition: all 0.3s;
}
.btn-surround:before,
.btn-surround:after {
content: "";
display: block;
position: absolute;
background-color: #65A04D;
top: 0;
pointer-events: none;
}
.btn-surround:before {
left: 0;
width: 0;
height: 2px;
}
.btn-surround:after {
right: 0;
width: 2px;
height: 0;
}
.btn-surround:hover {
background-color: #FFF;
color: #65A04D;
}
.btn-surround:hover:before {
width: 100%;
transition: width 0.2s 0.2s;
}
.btn-surround:hover:after {
height: 100%;
transition: height 0.1s 0.4s;
}
.btn-surround:hover span:before {
width: 100%;
transition: width 0.2s 0.5s;
}
.btn-surround:hover span:after {
height: 100%;
transition: height 0.1s 0.7s;
}
.btn-surround span:before,
.btn-surround span:after {
content: "";
display: block;
position: absolute;
background-color: #65A04D;
bottom: 0;
pointer-events: none;
}
.btn-surround span:before {
right: 0;
width: 0;
height: 2px;
}
.btn-surround span:after {
left: 0;
width: 2px;
height: 0;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.