前言

我正在参加中秋创意投稿大赛,详情请看​​juejin.cn/post/700315…​

我们先代码写诗

我们作为新一代的农民工,不仅有技术,而且有浪漫情怀,当那些文艺青年对月当歌,人生几何,我们酷炫极了,我们低下我们高贵的头颅,心里唱着rap,拇指翻飞,让pc对我们 sing poetry 来让我抛砖引玉(我拇指不够秀,敲出的很烂): 万里无云镜九洲,最团圆夜是中秋

中秋活动--让我们带着小玉兔一起读诗_前端

来只小玉兔

远在千里的我们,对着那轮明月,唱着诗歌,思念着远方的亲人,是否感到一点点孤独,没关系,小玉兔来了,而且它还会要摇着耳朵对我们say hi, "兔兔这么可爱,是想清蒸,还是红烧?"

先看个效果图 白色的 中秋活动--让我们带着小玉兔一起读诗_前端_02

粉色的

中秋活动--让我们带着小玉兔一起读诗_css_03

灰色的

中秋活动--让我们带着小玉兔一起读诗_css_04

。。。。太多了,可以随你心情来,高的,矮的,胖的,瘦的, 自己设置哦

废话不多数, 我的目录结构

中秋活动--让我们带着小玉兔一起读诗_5e_05

上代码

html文件

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Rabbit</title>
<link href='./css/new_file.css' rel="stylesheet"type="text/css"/>
</head>
<body>
<div class="rabbit">
<div class="rabbit__leg rabbit__leg--one">
</div>
<div class="rabbit__leg rabbit__leg--two">
</div>
<div class="rabbit__tail">
</div>
<div class="rabbit__body">
</div>
<div class="rabbit__leg rabbit__leg--three">
</div>
<div class="rabbit__leg rabbit__leg--four">
</div>
<div class="rabbit__ear rabbit__ear--right">
</div>
<div class="rabbit__head">
</div>
<div class="rabbit__ear rabbit__ear--left">
</div>
</div>

</body>
</html>

css文件(操控小兔子的核心)

html {
width: 100%;
height: 100%;
}

body {
width: 100%;
height: 100%;
background: white;
display: flex;
justify-content: center;
align-items: center;
}

.rabbit {
/*在行下面修改代码*/

--rabbit-basecolor: gray;

/*在行上面修改代码*/
position: relative;
}

.rabbit .rabbit__body {
width: 4em;
height: 5.6em;
background: #F4F4F4;
border-radius: 50% 50% 50% 50%/60% 60% 40% 40%;
-webkit-transform: rotate(-100deg);
transform: rotate(-40deg);
box-shadow: inset -2.3em -2.7em 0 0 var(--rabbit-basecolor);
}

.rabbit .rabbit__head {
position: absolute;
width: 4em;
height: 4.6em;
top: -2.5em;
left: -2em;
background: var(--rabbit-basecolor);
border-radius: 50% 50% 50% 50%/65% 60% 40% 35%;
-webkit-transform: rotate(-120deg);
transform: rotate(-120deg);
overflow: hidden;
}

.rabbit .rabbit__head:before {
content: "";
position: absolute;
width: 0.65em;
height: 0.5em;
top: -0.1em;
left: 1.8em;
background: #F97996;
border-radius: 50% 50% 50% 50%/30% 30% 70% 70%;
-webkit-transform: rotate(130deg);
transform: rotate(130deg);
}

.rabbit .rabbit__head:after {
content: "";
position: absolute;
width: 1em;
height: 1em;
top: 1.5em;
left: 1.6em;
background: #F4F4F4;
border-radius: 50%;
box-shadow: inset 0.1em 0.15em 0 0.37em #3D261C;
}

.rabbit .rabbit__ear {
position: absolute;
border-radius: 50% 50% 50% 50%/40% 40% 60% 60%;
-webkit-transform-origin: 50% 100%;
transform-origin: 50% 100%;
}

.rabbit .rabbit__ear--left {
width: 2.2em;
height: 4.7em;
top: -5.7em;
left: -0.2em;
background: #F3E3DE;
-webkit-transform: rotate(40deg);
transform: rotate(40deg);
box-shadow: inset 0.3em -0.4em 0 -0.1em var(--rabbit-basecolor);
-webkit-animation: ear-left 5s infinite ease-out;
animation: ear-left 5s infinite ease-out;
}

.rabbit .rabbit__ear--right {
width: 2em;
height: 4.7em;
top: -5.5em;
left: -0.7em;
background: var(--rabbit-basecolor);
-webkit-transform: rotate(10deg);
transform: rotate(10deg);
-webkit-animation: ear-right 5s infinite ease-out;
animation: ear-right 5s infinite ease-out;
}

.rabbit .rabbit__leg {
position: absolute;
}

.rabbit .rabbit__leg--one {
width: 0.8em;
height: 3em;
top: 2.3em;
left: 0.2em;
background: var(--rabbit-basecolor);
border-radius: 50% 50% 50% 50%/30% 30% 70% 70%;
-webkit-transform-origin: 50% 0%;
transform-origin: 50% 0%;
-webkit-transform: rotate(15deg);
transform: rotate(15deg);
}

.rabbit .rabbit__leg--one:before {
content: "";
position: absolute;
width: 0.8em;
height: 0.5em;
top: 2.6em;
left: -0.2em;
background: var(--rabbit-basecolor);
border-radius: 50% 50% 50% 50%/70% 70% 30% 30%;
-webkit-transform: rotate(-10deg);
transform: rotate(-10deg);
}

.rabbit .rabbit__leg--three {
width: 0.9em;
height: 3em;
top: 2.4em;
left: 0.7em;
background: var(--rabbit-basecolor);
border-radius: 50% 50% 50% 50%/30% 30% 70% 70%;
-webkit-transform-origin: 50% 0%;
transform-origin: 50% 0%;
-webkit-transform: rotate(10deg);
transform: rotate(10deg);
}

.rabbit .rabbit__leg--three:before {
content: "";
position: absolute;
width: 0.8em;
height: 0.5em;
top: 2.6em;
left: -0.2em;
background: var(--rabbit-basecolor);
border-radius: 50% 50% 50% 50%/70% 70% 30% 30%;
-webkit-transform: rotate(-10deg);
transform: rotate(-10deg);
}

.rabbit .rabbit__leg--two {
width: 2.6em;
height: 3.6em;
top: 1.7em;
left: 1.6em;
background: var(--rabbit-basecolor);
border-radius: 50% 50% 50% 50%/50% 50% 50% 50%;
-webkit-transform-origin: 50% 0%;
transform-origin: 50% 0%;
-webkit-transform: rotate(10deg);
transform: rotate(10deg);
}

.rabbit .rabbit__leg--two:before {
content: "";
position: absolute;
width: 1.6em;
height: 0.8em;
top: 3.05em;
left: 0em;
background: var(--rabbit-basecolor);
border-radius: 50% 50% 50% 50%/70% 70% 30% 30%;
-webkit-transform: rotate(-10deg);
transform: rotate(-10deg);
}

.rabbit .rabbit__leg--four {
width: 2.6em;
height: 3.6em;
top: 1.8em;
left: 2.1em;
background: var(--rabbit-basecolor);
border-radius: 50% 50% 50% 50%/50% 50% 50% 50%;
-webkit-transform-origin: 50% 0%;
transform-origin: 50% 0%;
-webkit-transform: rotate(10deg);
transform: rotate(10deg);
}

.rabbit .rabbit__leg--four:before {
content: "";
position: absolute;
width: 1.6em;
height: 0.8em;
top: 3.05em;
left: 0em;
background: var(--rabbit-basecolor);
border-radius: 50% 50% 50% 50%/70% 70% 30% 30%;
-webkit-transform: rotate(-10deg);
transform: rotate(-10deg);
}

.rabbit .rabbit__tail {
position: absolute;
width: 0.9em;
height: 0.9em;
top: 3.7em;
left: 4em;
background: var(--rabbit-basecolor);
-webkit-transform: rotate(25deg);
transform: rotate(25deg);
}

.rabbit .rabbit__tail:after, .rabbit .rabbit__tail:before {
content: "";
position: absolute;
width: 100%;
height: 100%;
background: var(--rabbit-basecolor);
border-radius: 50%;
}

.rabbit .rabbit__tail:before {
top: 0;
left: -50%;
}

.rabbit .rabbit__tail:after {
top: 50%;
left: 0;
}

@-webkit-keyframes ear-left {
0%, 20%, 100% {
-webkit-transform: rotate(40deg);
transform: rotate(40deg);
}

10%, 30%, 80% {
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}

90% {
-webkit-transform: rotate(50deg);
transform: rotate(50deg);
}
}

@keyframes ear-left {
0%, 20%, 100% {
-webkit-transform: rotate(40deg);
transform: rotate(40deg);
}

10%, 30%, 80% {
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}

90% {
-webkit-transform: rotate(50deg);
transform: rotate(50deg);
}
}

@-webkit-keyframes ear-right {
0%, 20%, 100% {
-webkit-transform: rotate(10deg);
transform: rotate(10deg);
}

10%, 30%, 80% {
-webkit-transform: rotate(5deg);
transform: rotate(5deg);
}

90% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
}

@keyframes ear-right {
0%, 20%, 100% {
-webkit-transform: rotate(10deg);
transform: rotate(10deg);
}

10%, 30%, 80% {
-webkit-transform: rotate(5deg);
transform: rotate(5deg);
}

90% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
}

好了,赶紧配好自己的小兔子,赏月吧

熟悉我的人都知道,我是个晒图狂魔,我没有长枪大炮拍月亮,但认识的摄影大佬会啊,他很慷慨的借我几张图,来让我们赏月

中秋活动--让我们带着小玉兔一起读诗_css_06

中秋活动--让我们带着小玉兔一起读诗_前端_07