Nakkan Base

お洒落な「Button」の装飾

YouTubeで、すっごくお洒落な装飾Buttonのcssを発見しました❗️

hoverすると、「ビョョーン」って横に伸びて、ネオンのように光ります💡

すごい! やってみたい!

cssも簡単です。

=index.html=

<!DOCTYPE html>
<html lang="ja">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Transform Botton</title>
  <link rel="stylesheet" type="text/css" href="btn-style.css">
</head>
<body>
  <a href="#" style="--clr:#1e9bff"><span>Button</span><i></i></a>
</body>
</html>

=style.css=

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #27282c;
}

a {
  position: relative;
  background: #444;
  color: #fff;
  text-decoration: none;
  text-transform: uppercase;
  font-size: 1.5em;
  letter-spacing: 0.1em;
  padding: 10px 30px;
  transition: 0.5s;
}

a:hover {
  letter-spacing: 0.25em;
  background: var(--clr);
  color: var(--clr);
  box-shadow: 0 0 35px var(--clr);
}

a::before {
  content: '';
  position: absolute;
  inset: 2px;
  background: #27282c;
}

a span {
  position: relative;
  z-index: 1;
}

a i {
  position: absolute;
  inset: 0;
  display: block;
}

a i::before {
  content: '';
  position: absolute;
  top: -3.5px;
  left: 80%;
  width: 10px;
  height: 5px;
  border: 2px solid var(--clr);
  background: #27282c;
  transition: 0.5s;
  transform: translateX(-50%);
}

a i::after {
  content: '';
  position: absolute;
  bottom: -3.5px;
  left: 20%;
  width: 10px;
  height: 5px;
  border: 2px solid var(--clr);
  background: #27282c;
  transition: 0.5s;
  transform: translateX(-50%);
}

a:hover i::before {
  width: 20px;
  left: 20%;
}

a:hover i::after {
  width: 20px;
  left: 80%;
}

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

*

CAPTCHA