<div class="layout">
<!-- ここからボタンのHTML -->
<!-- 上のボタン -->
<div class="button-01">
<a href="#"><span>ボタン</span></a>
</div>
<!-- 下のボタン -->
<div class="button-02">
<a href="#"><span>ボタン</span></a>
</div>
<!-- ここまでボタンのHTML -->
</div>
/* ここはレイアウトなのでボタンとは関係ない */
* {
margin: 0;
}
.layout {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
gap: 50px;
width: 100%;
height: 100vh;
}
/* 上のボタンのCSS */
.button-01 {
a {
position: relative;
display: block;
width: 240px;
height: 50px;
font-size: 16px;
text-decoration: none;
background-color: transparent;
color: #5cc0ef;
transition: all 0.3s;
&::before,
&::after {
content: "";
position: absolute;
top: 0;
left: 0;
background: #5cc0ef;
transition: all 0.3s;
}
&::before {
height: 24px;
width: 2px;
}
&::after {
width: 24px;
height: 2px;
}
span {
position: relative;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
&::before,
&::after {
content: "";
position: absolute;
bottom: 0;
right: 0;
background: #5cc0ef;
transition: all 0.3s ease;
}
&::before {
height: 24px;
width: 2px;
}
&::after {
width: 24px;
height: 2px;
}
}
&:hover {
&::before {
height: calc(100% + 5px);
}
&::after {
width: calc(100% + 5px);
}
span {
&::before {
height: calc(100% + 5px);
}
&::after {
width: calc(100% + 5px);
}
}
}
}
}
.button-02 {
a {
position: relative;
display: block;
width: 240px;
height: 50px;
font-size: 16px;
text-decoration: none;
background-color: transparent;
color: #5cc0ef;
transition: all 0.3s;
&::before,
&::after {
content: "";
position: absolute;
top: 0;
right: 0;
background: #5cc0ef;
transition: all 0.3s;
}
&::before {
height: 24px;
width: 2px;
}
&::after {
width: 24px;
height: 2px;
}
span {
position: relative;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
&::before,
&::after {
content: "";
position: absolute;
bottom: 0;
left: 0;
background: #5cc0ef;
transition: all 0.3s ease;
}
&::before {
height: 24px;
width: 2px;
}
&::after {
width: 24px;
height: 2px;
}
}
&:hover {
&::before {
height: calc(100% + 5px);
}
&::after {
width: calc(100% + 5px);
}
span {
&::before {
height: calc(100% + 5px);
}
&::after {
width: calc(100% + 5px);
}
}
}
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.