欢迎光临散文网 会员登陆 & 注册

一个特别的作品[手把手教程·代码]#国庆#2023#1949#

2023-09-21 02:03 作者:泥想什么呢想  | 我要投稿

index.html

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<title>CSS Animation</title>

<link rel="stylesheet" type="text/css" href="style.css">

</head>

<body>

<div class="box">

<h2>1949</h2>

</div>

<div class="box">

<h2>❤</h2>

</div>

<div class="box">

<h2>2023</h2>

</div>

</body>

</html>

style.css

@import url('https://fonts.googleapis.com/css?family=Poppins:200,300,400,500,600,700,800,900&display=swap');

*

{

margin: 0;

padding: 0;

box-sizing: border-box;

font-family: 'KaiTi',sans-serif;

}

body

{

display: flex;

justify-content: center;

align-items: center;

min-height: 100vh;

background: #25252b;

gap: 100p;

flex-wrap: wrap;

}

@property --a

{

syntax:'<angle>';

inherits:false;

initial-value:0deg;

}

.box 

{

position: relative;

width: 300px;

height: 300px;

background: repeating-conic-gradient(from var(--a),#ff2770 0%,#ff2770 5%,transparent 5%,transparent 40%,#ff2770 50%);

animation: rotating 2s linear infinite;

animation-play-state: paused;

border-radius: 20px;

filter: drop-shadow(0 15px 50px #000);

display: flex;

justify-content: center;

align-items: center;

}

.box:nth-child(1)

{

filter: drop-shadow(0 15px 50px #000) hue-rotate(225deg);

}

.box:nth-child(3)

{

filter: drop-shadow(0 15px 50px #000) hue-rotate(310deg);

}

@keyframes rotating

{

0%

{

--a:0deg;

}

100%

{

--a:360deg;

}

}

.box:before

{

content: '';

position: absolute;

width: 100%;

height: 100%;

background: repeating-conic-gradient(from var(--a),#45f3ff 0%,#45f3ff 5%,transparent 5%,transparent 40%,#45f3ff 50%);

animation: rotating 2s linear infinite;

animation-delay: -0.5s;

animation-play-state: paused;

border-radius: 20px;

}

.box:hover,

.box:hover::before

{

animation-play-state: running;

}

.box:after

{

content: '';

position: absolute;

inset: 6px;

border: 8px solid #25252b;

border-radius: 15px;

background: #2d2d39;

}

.box h2

{

position: absolute;

inset: 40px;

display: flex;

justify-content: center;

align-items: center;

border-radius: 10px;

background: rgba(0, 0, 0, 0.2);

color: #fff;

font-size: 2.5em;

font-weight: 500;

z-index: 10000;

text-transform: uppercase;

box-shadow: inset 0 10px 20px rgba(0, 0, 0, 0.5);

border-bottom: 2px solid rgba(255, 255, 255, 0.15);

}

一个特别的作品[手把手教程·代码]#国庆#2023#1949#的评论 (共 条)

分享到微博请遵守国家法律