スイッチボタン
DEMO
HTMLとCSSをまとめてコピーする
HTML
<a class="btn-emergency" href="リンク先URL">
<span class="btn-emergency-bottom"></span>
<span class="btn-emergency-top"><span>押す</span></span>
</a>
HTMLをコピーする
HTML説明
リンクの設定方法
リンク先URL(1行目)のテキストを任意のURLに書き換えてください
CSS
<style>
.btn,
a.btn,
button.btn {
font-size: 1.6rem;
font-weight: 700;
line-height: 1.5;
position: relative;
display: inline-block;
padding: 1rem 4rem;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-transition: all 0.3s;
transition: all 0.3s;
text-align: center;
vertical-align: middle;
text-decoration: none;
letter-spacing: 0.1em;
color: #212529;
border-radius: 0.5rem;
}
a.btn-emergency {
position: relative;
display: block;
width: 200px;
height: 130px;
margin: 0 auto;
}
a.btn-emergency:hover .btn-emergency-top {
top: 10px;
height: 50px;
}
a.btn-emergency:active .btn-emergency-top {
top: 20px;
height: 40px;
}
.btn-emergency-top {
position: absolute;
top: 0;
left: 20px;
width: 160px;
height: 60px;
margin-top: 30px;
-webkit-transition: all 0.3s;
transition: all 0.3s;
border-radius: 0 0 50% 50%;
background: #d62d2d;
}
.btn-emergency-top:before {
position: absolute;
top: -30px;
left: 0;
width: 160px;
height: 60px;
content: "";
border-radius: 80px / 30px;
background: #ed4c4c;
}
.btn-emergency-top span {
font-size: 38px;
font-weight: bold;
position: absolute;
top: -24px;
left: 0;
width: 100%;
-webkit-transform: scaleY(0.75);
transform: scaleY(0.75);
text-align: center;
color: #f6a3a3;
}
.btn-emergency-bottom {
position: absolute;
top: 38px;
left: 0;
width: 200px;
height: 80px;
border-radius: 100px / 40px;
background: #d8e4ea;
-webkit-box-shadow: 0 8px 0 #c4cacc;
box-shadow: 0 8px 0 #c4cacc;
}
</style>
cssをコピーする
CSS説明
こちらは特に編集する必要はありません。
詳しい方は色やフォントなど自由に編集してご使用ください。