<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
<style>@charset "utf-8";
/*== 背景共通設定 */
body {
width: 100%;
height: 100vh;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
background-image: url("/wp-content/uploads/demos/_assets/img_06.jpg");
object-fit: cover;
}
/* クリックしたら波紋が広がる */
.btnripple {
/*波紋の基点とするためrelativeを指定*/
position: relative;
/*はみ出す波紋を隠す*/
overflow: hidden;
/*ボタンの形状*/
text-decoration: none;
display: inline-block;
color: #333;
padding: 20px 25px;
text-align: center;
font-size: clamp(0.8rem, 2vw, 1rem);
width: clamp(240px, 50vw, 500px);
border: 1px solid rgba(255, 255, 255, 0.18);
border-radius: 12px;
-webkit-border-radius: 12px;
background-color: rgba(255, 255, 255, 0.3);
backdrop-filter: blur(6.5px);
-webkit-backdrop-filter: blur(6.5px);
box-shadow: rgba(142, 142, 142, 0.19) 0px 6px 15px 0px;
-webkit-box-shadow: rgba(142, 142, 142, 0.19) 0px 6px 15px 0px;
outline: none;
}
.btnripple::after {
content: "";
/*絶対配置で波紋位置を決める*/
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
/*波紋の形状*/
background: radial-gradient(circle, #fff 10%, transparent 10%) no-repeat 50%;
transform: scale(10, 10);
/*はじめは透過0に*/
opacity: 0;
/*アニメーションの設定*/
transition: transform 0.3s, opacity 1s;
}
/*クリックされたあとの形状の設定*/
.btnripple:active::after {
transform: scale(0, 0);
transition: 0s;
opacity: 0.9;
}
/*========= レイアウトのためのCSS ===============*/
body {
vertical-align: middle;
padding: 15% 0;
text-align: center;
}
p {
margin: 0 0 10px 0;
}</style>
</head>
<body>
<body>
<a href="#" class="btnripple">クリックしたら波紋が広がる</a>
<script>
</script>
</body>
</html>
/*
外部依存 CSS:
- https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css
*/
@charset "utf-8";
/*== 背景共通設定 */
body {
width: 100%;
height: 100vh;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
background-image: url("/wp-content/uploads/demos/_assets/img_06.jpg");
object-fit: cover;
}
/* クリックしたら波紋が広がる */
.btnripple {
/*波紋の基点とするためrelativeを指定*/
position: relative;
/*はみ出す波紋を隠す*/
overflow: hidden;
/*ボタンの形状*/
text-decoration: none;
display: inline-block;
color: #333;
padding: 20px 25px;
text-align: center;
font-size: clamp(0.8rem, 2vw, 1rem);
width: clamp(240px, 50vw, 500px);
border: 1px solid rgba(255, 255, 255, 0.18);
border-radius: 12px;
-webkit-border-radius: 12px;
background-color: rgba(255, 255, 255, 0.3);
backdrop-filter: blur(6.5px);
-webkit-backdrop-filter: blur(6.5px);
box-shadow: rgba(142, 142, 142, 0.19) 0px 6px 15px 0px;
-webkit-box-shadow: rgba(142, 142, 142, 0.19) 0px 6px 15px 0px;
outline: none;
}
.btnripple::after {
content: "";
/*絶対配置で波紋位置を決める*/
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
/*波紋の形状*/
background: radial-gradient(circle, #fff 10%, transparent 10%) no-repeat 50%;
transform: scale(10, 10);
/*はじめは透過0に*/
opacity: 0;
/*アニメーションの設定*/
transition: transform 0.3s, opacity 1s;
}
/*クリックされたあとの形状の設定*/
.btnripple:active::after {
transform: scale(0, 0);
transition: 0s;
opacity: 0.9;
}
/*========= レイアウトのためのCSS ===============*/
body {
vertical-align: middle;
padding: 15% 0;
text-align: center;
}
p {
margin: 0 0 10px 0;
}
/*
外部依存 CSS (このデモは下記の CSS にも依存します):
- https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css
*/