BUTTONボタン
-
ボタン:ベース
read morea.link { font-size: 1.6rem; font-size: 16px; font-weight: bold; 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; text-align: center; vertical-align: middle; text-decoration: none; letter-spacing: 0.1em; } a.link-flat{ overflow: hidden; padding: 1rem 6rem; color: #fff; background: #000; position: relative; } a.link-flat::after { content: ''; font-family: "Font Awesome 5 Free"; content: "\f054"; font-weight: 900; padding-right: 5px; color: #fff; position: absolute; right: 10px; -webkit-transition: all .3s ease-in-out; transition: all .3s ease-in-out; } a.link-flat span { position: relative; } a.link-flat:hover { background: #0090d5; } a.link-flat:hover::after { right: 0; }
上記のボタン:ベースにコードを追記して使用する。
-
ボタン:左から右へ(水平)
read morea.link-flat::before { position: absolute; top: 0; left: 0; width: 100%; height: 100%; content: ''; -webkit-transition: all .3s ease-in-out; transition: all .3s ease-in-out; -webkit-transform: translateX(-100%); transform: translateX(-100%); background: #0090d5; } a.link-flat:hover::before { -webkit-transform: translateX(0%); transform: translateX(0%); } -
ボタン:左から右へ(斜め)
read morea.link-flat::before { position: absolute; top: 0; left: 0; width: 100%; height: 100%; content: ''; -webkit-transition: all .3s ease-in-out; transition: all .3s ease-in-out; -webkit-transform: translateX(-100%); transform: translateX(-100%); background: #0090d5; } a.link-flat:hover::before { -webkit-transform: translateX(0%); transform: translateX(0%); } -
ボタン:左から右へ(円形)
read morea.link-flat::before { position: absolute; top: 0; left: 0; width: 100px; height: 100px; content: ''; -webkit-transition: all .5s ease-in-out; transition: all .5s ease-in-out; -webkit-transform: translateX(-100%) translateY(-25px); transform: translateX(-100%) translateY(-25px); background: #0090d5; border-radius: 50%; } a.link-flat:hover::before { width: 400px; height: 400px; -webkit-transform: translateX(-1%) translateY(-175px); transform: translateX(-1%) translateY(-175px); } -
ボタン:グラデーション
read morea.link-flat { position:relative; z-index:0; } a.link-flat::before{ content:""; width:100%; height:100%; position:absolute; z-index:-1; left:0; top: 0; transition:0.5s; background: linear-gradient(45deg, rgba(0,144,213,1) 0%, rgba(0,0,0,1) 100%); } a.link-flat::after{ content:""; width:100%; height:100%; position:absolute; z-index:-2; left:0; top: 0; background: linear-gradient(45deg, rgba(0,0,0,1) 0%, rgba(0,144,213,1) 100%); } a.link-flat:hover::before{ opacity:0; }
-
トップへ戻るボタン:四角
.square-up{ /* 画面右端下に追従させるための表記 position: fixed; right: 10px; bottom: 10px; */ font-size: 2.5rem; background: #fff; color: #000; padding: 10px; width: 40px; height: 40px; display: flex; justify-content: center; align-items: center; border: solid 2px #000; transition: 0.3s; } .square-up div{ display: block; margin-top: 10px; width: 20px; height: 16px; border-top: 2px solid #000; border-left: 2px solid #000; transform: rotate(45deg); } .square-up:hover{ box-shadow: 0 2px 10px -6px rgba(0,0,0,.5), 0 3px 10px -4px rgba(0,0,0,.2); background: #000; color: #fff; } .square-up:hover div{ border-top: 2px solid #fff; border-left: 2px solid #fff; } -
トップへ戻るボタン:丸
.circle-up{ font-size: 2.5rem; background: #fff; color: #000; padding: 10px; width: 40px; height: 40px; display: flex; justify-content: center; align-items: center; border: solid 2px; border-radius: 50%; transition: 0.3s; } .circle-up:hover{ box-shadow: 0 2px 10px -6px rgba(0,0,0,.5), 0 3px 10px -4px rgba(0,0,0,.2); } -
トップへ戻るボタン:矢印
.arrow-up{ display: flex; justify-content: center; padding-left: 3rem; height: 50px; width: 65px; text-decoration: none; font-weight: bold; transform: rotate(90deg); font-size: 90%; line-height: 2rem; color: #737373; } .arrow-up::before{ content: ""; display: block; position: absolute; top: -1px; left: 0px; width: 15px; border-top: solid 1px; transform: rotate(35deg); transform-origin: left top; transition: 0.3s; } .arrow-up::after{ content: ""; display: block; position: absolute; height: 50px; width: 65px; top: -1px; right: 1px; border-top: solid 1px; transition: 0.3s; } .arrow-up:hover::before{ transform: rotate(35deg) translateX(-6px) translateY(5px); } .arrow-up:hover::after{ transform: translateX(-8px); } -
トップへ戻るボタン:シンプル
.simple-up{ width: 40px; background: none; color: #000; border-top: 3px solid #000; display: block; } simple-up::before{ display:none; } simple-up::after{ content:"↑"; display:block; text-align:center; padding-top:0.5rem; font-size:30px; transition: 0.3s; } simple-up:hover::after{ transform: translateY(-8px); } -
トップへ戻るボタン:文字
.font-up{ font-size: 1.6rem; background: #000; color: #fff; padding: 0.5rem 1rem; display: flex; justify-content: center; align-items: center; border: solid 2px #000; transition: 0.3s; } .font-up:hover{ box-shadow: 0 2px 10px -6px rgba(0,0,0,.5), 0 3px 10px -4px rgba(0,0,0,.2); background: #fff; color: #000; }
.link-button div.row div a {
overflow: hidden;
height: 320px;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
line-height: 50px;
position: relative;
text-align: center;
font-size: 5.5rem;
font-size: 55px;
font-weight: 600;
color: inherit;
}
.link-button div.row div a::after {
content: "";
width: 100%;
height: 100%;
position: absolute;
z-index: 0;
left: 0;
top: 0;
transition: 0.5s;
background: url("../img/top-link-back-1.webp");
background-color: rgba(0, 0, 0, 0.6);
background-repeat: no-repeat;
background-size: cover;
background-blend-mode: multiply;
}
.link-button div.row div a::before {
content: "";
width: 100%;
height: 100%;
position: absolute;
z-index: 0;
left: 0;
top: 0;
transition: 0.5s;
background: url("../img/top-link-back-1.webp");
background-color: rgba(0, 0, 0, 0.2);
background-repeat: no-repeat;
background-size: cover;
background-blend-mode: multiply;
}
.link-button div.row div a:hover::before {
-moz-transform: scale(1.1);
-webkit-transform: scale(1.1);
-ms-transform: scale(1.1);
transform: scale(1.1);
}
.link-button div.row div a:hover::after {
opacity: 0;
-moz-transform: scale(1.1);
-webkit-transform: scale(1.1);
-ms-transform: scale(1.1);
transform: scale(1.1);
}
.link-button div.row div a p {
position: relative;
z-index: 2;
line-height: normal;
color: #fff;
}
.link-button div.row div a p span {
width: 250px;
padding: 0.5rem;
display: block;
margin: auto;
margin-top: 1rem;
background: #000;
color: #fff;
font-size: 2rem;
font-size: 20px;
font-weight: normal;
border-radius: 3rem;
transition: 0.3s;
}
.link-button div.row div a:hover p span {
background: #0090d5;
}
.link-button div.row div a.button-b::before {
background: url("../img/top-link-back-2.webp");
background-color: rgba(0, 0, 0, 0.3);
background-repeat: no-repeat;
background-size: cover;
background-blend-mode: multiply;
}
.link-button div.row div a.button-b::after {
background: url("../img/top-link-back-2.webp");
background-color: rgba(0, 0, 0, 0.6);
background-repeat: no-repeat;
background-size: cover;
background-blend-mode: multiply;
}