├── README.md
├── ball-loading
├── index.css
└── index.html
├── check-list
├── index.css
└── index.html
├── childhood-game
├── index.css
└── index.html
├── data-night-switch
├── index.css
└── index.html
├── login-page
├── index.css
└── index.html
├── one-div-ball-loading
├── index.css
└── index.html
├── pencil-folder
├── index.css
└── index.html
├── profile-card
├── avatar.svg
├── facebook.svg
├── index.css
├── index.html
├── instagram.svg
├── linkedIn.svg
└── twitter.svg
├── ps5-loading-icon
├── index.css
└── index.html
└── yuanshen-calendar
├── index.css
└── index.html
/README.md:
--------------------------------------------------------------------------------
1 | ### CSS 案例目录
2 |
3 | 1. **[CSS案例: 元素周期表](https://github.com/Fengzhen8023/css-demo/tree/periodic_table)**
4 |
5 | 视频地址: [「CSS 案例」元素周期表](https://www.bilibili.com/video/av80244004/ )
6 |
7 | 2. **[CSS案例: 太极八卦图](https://github.com/Fengzhen8023/css-demo/tree/taiji)**
8 |
9 | 视频地址: [「CSS 案例」太极八卦图](https://www.bilibili.com/video/av80849979/ )
10 |
11 | 3. **[CSS案例: 手机充电动态图](https://github.com/Fengzhen8023/css-demo/tree/charge)**
12 |
13 | 视频地址:
14 | [「CSS 案例」手机充电特效(上)](https://www.bilibili.com/video/av81476442/ )
15 | [「CSS 案例」手机充电特效(下)](https://www.bilibili.com/video/av81592657/ )
16 |
17 | 4. **[CSS案例: CSS绘制40种基本图形](https://github.com/Fengzhen8023/css-demo/tree/basic_graph)**
18 |
19 | 视频地址:
20 | [「CSS 案例」CSS绘制40种常见图形(上)](https://www.bilibili.com/video/av82203155/ )
21 | [「CSS 案例」CSS绘制40种常见图形(下)](https://www.bilibili.com/video/av82741876/ )
22 |
23 | 5. **[CSS案例: 一键三连UI和动画效果]( https://github.com/Fengzhen8023/css-demo/tree/yi_jian_san_lian)**
24 |
25 | 视频地址:
26 | [「CSS 案例」B站一键三连UI效果](https://www.bilibili.com/video/av83146082/ )
27 | [「CSS 案例」B站一键三连动画效果](https://www.bilibili.com/video/av83202745/ )
28 |
29 | 6. **[CSS案例: 弹性小球加载效果](https://github.com/Fengzhen8023/css-demo/tree/elastic_ball)**
30 |
31 | 视频地址: [「CSS 案例」太极八卦图](https://www.bilibili.com/video/av84140553/ )
32 |
33 | 7. **[CSS制作MG动画:闪光眼镜三连效果](https://github.com/Fengzhen8023/css-demo/tree/glass)**
34 |
35 | 视频地址: [「CSS 案例」太极八卦图](https://www.bilibili.com/video/av86280370/ )
36 |
37 | 8. **[CSS制作MG动画:B站LOGO](https://github.com/Fengzhen8023/css-demo/tree/B-logo)**
38 |
39 | 视频地址: [「CSS 案例」B站LOGO](https://www.bilibili.com/video/av91164042/ )
40 |
41 | 9. **[CSS制作MG动画:动态方块加载框](https://github.com/Fengzhen8023/css-demo/tree/loading-diamond)**
42 |
43 | 视频地址: [「CSS 案例」B站LOGO](https://www.bilibili.com/video/av93716609/ )
44 |
45 | 10. **[CSS案例: 焰灵姬动态音乐播放UI](https://github.com/Fengzhen8023/css-demo/tree/yan_ling_ji_music)**
46 |
47 | 视频地址: [「CSS 案例」焰灵姬动态音乐播放UI](https://www.bilibili.com/video/BV15D4y1X79h/ )
48 |
49 |
--------------------------------------------------------------------------------
/ball-loading/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | padding: 0;
4 | width: 100vw;
5 | height: 100vh;
6 | display: flex;
7 | justify-content: center;
8 | align-items: center;
9 | }
10 |
11 | .dot-spinner {
12 | --uib-size: 2.8rem;
13 | --uib-speed: .9s;
14 | --uib-color: #183153;
15 | position: relative;
16 | display: flex;
17 | align-items: center;
18 | justify-content: flex-start;
19 | height: var(--uib-size);
20 | width: var(--uib-size);
21 | }
22 |
23 | .dot-spinner__dot {
24 | position: absolute;
25 | top: 0;
26 | left: 0;
27 | display: flex;
28 | align-items: center;
29 | justify-content: flex-start;
30 | height: 100%;
31 | width: 100%;
32 | }
33 |
34 | .dot-spinner__dot::before {
35 | content: '';
36 | height: 20%;
37 | width: 20%;
38 | border-radius: 50%;
39 | background-color: var(--uib-color);
40 | transform: scale(0);
41 | opacity: 0.5;
42 | box-shadow: 0 0 20px rgba(18, 31, 53, 0.3);
43 | }
44 |
45 | @keyframes pulse0112 {
46 |
47 | 0%,
48 | 100% {
49 | transform: scale(0);
50 | opacity: 0.5;
51 | }
52 |
53 | 50% {
54 | transform: scale(1);
55 | opacity: 1;
56 | }
57 | }
58 |
59 | .dot-spinner__dot::before {
60 | animation: pulse0112 calc(var(--uib-speed) * 1.111) ease-in-out infinite;
61 | }
62 |
63 | .dot-spinner__dot:nth-child(2) {
64 | transform: rotate(45deg);
65 | }
66 |
67 | .dot-spinner__dot:nth-child(2)::before {
68 | animation-delay: calc(var(--uib-speed) * -0.875);
69 | }
70 |
71 | .dot-spinner__dot:nth-child(3) {
72 | transform: rotate(90deg);
73 | }
74 |
75 | .dot-spinner__dot:nth-child(3)::before {
76 | animation-delay: calc(var(--uib-speed) * -0.75);
77 | }
78 |
79 | .dot-spinner__dot:nth-child(4) {
80 | transform: rotate(135deg);
81 | }
82 |
83 | .dot-spinner__dot:nth-child(4)::before {
84 | animation-delay: calc(var(--uib-speed) * -0.625);
85 | }
86 |
87 | .dot-spinner__dot:nth-child(5) {
88 | transform: rotate(180deg);
89 | }
90 |
91 | .dot-spinner__dot:nth-child(5)::before {
92 | animation-delay: calc(var(--uib-speed) * -0.5);
93 | }
94 |
95 | .dot-spinner__dot:nth-child(6) {
96 | transform: rotate(225deg);
97 | }
98 |
99 | .dot-spinner__dot:nth-child(6)::before {
100 | animation-delay: calc(var(--uib-speed) * -0.375);
101 | }
102 |
103 | .dot-spinner__dot:nth-child(7) {
104 | transform: rotate(270deg);
105 | }
106 |
107 | .dot-spinner__dot:nth-child(7)::before {
108 | animation-delay: calc(var(--uib-speed) * -0.25);
109 | }
110 |
111 | .dot-spinner__dot:nth-child(8) {
112 | transform: rotate(315deg);
113 | }
114 |
115 | .dot-spinner__dot:nth-child(8)::before {
116 | animation-delay: calc(var(--uib-speed) * -0.125);
117 | }
--------------------------------------------------------------------------------
/ball-loading/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Document
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/check-list/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | background: #e8e8e8;
3 | margin: 0;
4 | display: flex;
5 | align-items: center;
6 | justify-content: center;
7 | height: 100vh;
8 | }
9 |
10 | #checklist {
11 | --background: #fff;
12 | --text: #414856;
13 | --check: #4f29f0;
14 | --disabled: #c3c8de;
15 | --width: 100px;
16 | --height: 180px;
17 | --border-radius: 10px;
18 | background: var(--background);
19 | width: var(--width);
20 | height: var(--height);
21 | border-radius: var(--border-radius);
22 | position: relative;
23 | box-shadow: 0 10px 30px rgba(65, 72, 86, 0.05);
24 | padding: 30px 85px;
25 | display: grid;
26 | grid-template-columns: 30px auto;
27 | align-items: center;
28 | justify-content: center;
29 | }
30 |
31 | #checklist label {
32 | color: var(--text);
33 | position: relative;
34 | cursor: pointer;
35 | display: grid;
36 | align-items: center;
37 | width: fit-content;
38 | transition: color 0.3s ease;
39 | margin-right: 20px;
40 | }
41 |
42 | #checklist label::before,
43 | #checklist label::after {
44 | content: "";
45 | position: absolute;
46 | }
47 |
48 | #checklist label::before {
49 | height: 2px;
50 | width: 8px;
51 | left: -27px;
52 | background: var(--check);
53 | border-radius: 2px;
54 | transition: background 0.3s ease;
55 | }
56 |
57 | #checklist label:after {
58 | height: 4px;
59 | width: 4px;
60 | top: 8px;
61 | left: -25px;
62 | border-radius: 50%;
63 | }
64 |
65 | #checklist input[type="checkbox"] {
66 | -webkit-appearance: none;
67 | -moz-appearance: none;
68 | position: relative;
69 | height: 15px;
70 | width: 15px;
71 | outline: none;
72 | border: 0;
73 | margin: 0 15px 0 0;
74 | cursor: pointer;
75 | background: var(--background);
76 | display: grid;
77 | align-items: center;
78 | margin-right: 20px;
79 | }
80 |
81 | #checklist input[type="checkbox"]::before,
82 | #checklist input[type="checkbox"]::after {
83 | content: "";
84 | position: absolute;
85 | height: 2px;
86 | top: auto;
87 | background: var(--check);
88 | border-radius: 2px;
89 | }
90 |
91 | #checklist input[type="checkbox"]::before {
92 | width: 0px;
93 | right: 60%;
94 | transform-origin: right bottom;
95 | }
96 |
97 | #checklist input[type="checkbox"]::after {
98 | width: 0px;
99 | left: 40%;
100 | transform-origin: left bottom;
101 | }
102 |
103 | @keyframes check-01 {
104 | 0% {
105 | width: 4px;
106 | top: auto;
107 | transform: rotate(0);
108 | }
109 |
110 | 50% {
111 | width: 0px;
112 | top: auto;
113 | transform: rotate(0);
114 | }
115 |
116 | 51% {
117 | width: 0px;
118 | top: 8px;
119 | transform: rotate(45deg);
120 | }
121 |
122 | 100% {
123 | width: 5px;
124 | top: 8px;
125 | transform: rotate(45deg);
126 | }
127 | }
128 |
129 | #checklist input[type="checkbox"]:checked::before {
130 | animation: check-01 0.4s ease forwards;
131 | }
132 |
133 | @keyframes check-02 {
134 | 0% {
135 | width: 4px;
136 | top: auto;
137 | transform: rotate(0);
138 | }
139 |
140 | 50% {
141 | width: 0px;
142 | top: auto;
143 | transform: rotate(0);
144 | }
145 |
146 | 51% {
147 | width: 0px;
148 | top: 8px;
149 | transform: rotate(-45deg);
150 | }
151 |
152 | 100% {
153 | width: 10px;
154 | top: 8px;
155 | transform: rotate(-45deg);
156 | }
157 | }
158 |
159 | #checklist input[type="checkbox"]:checked::after {
160 | animation: check-02 0.4s ease forwards;
161 | }
162 |
163 | @keyframes move {
164 | 50% {
165 | padding-left: 8px;
166 | padding-right: 0px;
167 | }
168 |
169 | 100% {
170 | padding-right: 4px;
171 | }
172 | }
173 |
174 | #checklist input[type="checkbox"]:checked+label {
175 | color: var(--disabled);
176 | animation: move 0.3s ease 0.1s forwards;
177 | }
178 |
179 | @keyframes slice {
180 | 60% {
181 | width: 100%;
182 | left: 4px;
183 | }
184 |
185 | 100% {
186 | width: 100%;
187 | left: -2px;
188 | padding-left: 0;
189 | }
190 | }
191 |
192 | #checklist input[type="checkbox"]:checked+label::before {
193 | background: var(--disabled);
194 | animation: slice 0.4s ease forwards;
195 | }
196 |
197 | @keyframes firework {
198 | 0% {
199 | opacity: 1;
200 | box-shadow: 0 0 0 -2px #4f29f0, 0 0 0 -2px #4f29f0,
201 | 0 0 0 -2px #4f29f0, 0 0 0 -2px #4f29f0,
202 | 0 0 0 -2px #4f29f0,0 0 0 -2px #4f29f0;
203 | }
204 |
205 | 30% {
206 | opacity: 1;
207 | }
208 |
209 | 100% {
210 | opacity: 0;
211 | box-shadow: 0 -15px 0 0px #4f29f0, 14px -8px 0 0px #4f29f0,
212 | 14px 8px 0 0px #4f29f0, 0 15px 0 0px #4f29f0,
213 | -14px 8px 0 0px #4f29f0, -14px -8px 0 0px #4f29f0;
214 | }
215 | }
216 |
217 | #checklist input[type="checkbox"]:checked+label::after {
218 | animation: firework 0.5s ease forwards 0.1s;
219 | }
--------------------------------------------------------------------------------
/check-list/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Document
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/childhood-game/index.css:
--------------------------------------------------------------------------------
1 | html,
2 | body,
3 | .container {
4 | margin: 0;
5 | padding: 0;
6 | height: 100%
7 | }
8 |
9 | body {
10 | background: #EEF2FE;
11 | }
12 |
13 | .container {
14 | display: grid;
15 | align-items: center;
16 | justify-content: center;
17 | }
18 |
19 | .kawaii-gameboy {
20 | display: grid;
21 | align-items: center;
22 | justify-content: center;
23 | height: 322px;
24 | width: 218px;
25 | background: #F4646E;
26 | border-radius: 16px;
27 | box-shadow:
28 | -26px 0 0 #82174D,
29 | -42px 16px 0 #86ACFF;
30 | transform: scale(1.5);
31 | }
32 |
33 | .screen-gameboy {
34 | display: flex;
35 | align-items: center;
36 | justify-content: center;
37 | height: 142px;
38 | width: 178px;
39 | background: #82174D;
40 | border-radius: 6px;
41 | }
42 |
43 | .dot {
44 | display: block;
45 | height: 10px;
46 | width: 10px;
47 | background: #FDA2B4;
48 | transform: translate(-14px, -23px);
49 | border-radius: 50%;
50 | }
51 |
52 | .screen {
53 | display: grid;
54 | align-items: center;
55 | justify-content: center;
56 | height: 106px;
57 | width: 120px;
58 | background: #EEF2FE;
59 | transform: translate(-5px);
60 | }
61 |
62 | .face-container {
63 | display: grid;
64 | align-items: center;
65 | justify-content: center;
66 | height: 50px;
67 | width: 90px;
68 | }
69 |
70 | .eyes-container {
71 | display: grid;
72 | justify-self: center;
73 | height: 28px;
74 | width: 81px;
75 | }
76 |
77 | .left-eye {
78 | display: grid;
79 | align-items: center;
80 | justify-content: center;
81 | height: 28px;
82 | width: 28px;
83 | background: #FDA2B1;
84 | border-radius: 50%;
85 | box-shadow: 53px 0 #FDA2B1;
86 | }
87 |
88 | .left-eye:before {
89 | content: "";
90 | display: block;
91 | height: 20px;
92 | width: 20px;
93 | background: #801649;
94 | border-radius: 50%;
95 | box-shadow: 53px 0 #801649;
96 | transform: translate(0px, 3px);
97 | }
98 |
99 | .left-eye:after {
100 | content: "";
101 | display: block;
102 | height: 5px;
103 | width: 5px;
104 | border-radius: 50%;
105 | background: #fff;
106 | transform: translate(12px, -8px);
107 | box-shadow:
108 | -7px -6px 0px 1px white,
109 | 52px 0px 0px white,
110 | 46px -6px 0px 1px white;
111 | }
112 |
113 | .mouth {
114 | display: grid;
115 | justify-self: center;
116 | height: 17px;
117 | width: 34px;
118 | background: #791949;
119 | border-radius: 0 0 16px 16px;
120 | transform: translate(0px, 5px);
121 | }
122 |
123 | .cheeks-container {
124 | display: grid;
125 | height: 10px;
126 | width: 90px;
127 | transform: translate(0px, -11px);
128 | }
129 |
130 | .cheek {
131 | display: grid;
132 | height: 10px;
133 | width: 22px;
134 | background: #87ADFF;
135 | border-radius: 100% 100%;
136 | box-shadow: 68px 0 #87ADFF;
137 | }
138 |
139 | .control-button-container {
140 | display: flex;
141 | justify-self: center;
142 | height: 60px;
143 | width: 172px;
144 | }
145 |
146 | .pad-container {
147 | display: grid;
148 | align-items: center;
149 | justify-content: center;
150 | height: 60px;
151 | width: 60px;
152 | background: #FFA5B1;
153 | border-radius: 50%;
154 | }
155 |
156 | .pad {
157 | display: block;
158 | height: 48px;
159 | width: 14px;
160 | background: #82174D;
161 | border-radius: 4px;
162 | }
163 |
164 | .pad:before {
165 | content: "";
166 | display: block;
167 | height: 14px;
168 | width: 48px;
169 | background: #82174D;
170 | border-radius: 4px;
171 | transform: translate(-17px, 17px);
172 | }
173 |
174 | .action-button-container {
175 | display: grid;
176 | align-items: center;
177 | height: 34px;
178 | width: 70px;
179 | background: #FFA5B1;
180 | border-radius: 17px;
181 | transform: rotate(-28deg) translate(32px, 33px);
182 | }
183 |
184 | .action-button {
185 | display: block;
186 | height: 24px;
187 | width: 24px;
188 | background: #82174D;
189 | border-radius: 50%;
190 | transform: translate(6px);
191 | box-shadow: 34px 0px #82174D;
192 | }
193 |
194 | .option-button-container {
195 | display: flex;
196 | justify-self: center;
197 | height: 10px;
198 | width: 64px;
199 | }
200 |
201 | .button {
202 | display: block;
203 | height: 10px;
204 | width: 28px;
205 | background: #82174B;
206 | border-radius: 5px;
207 | box-shadow: 36px 0px #82174B
208 | }
--------------------------------------------------------------------------------
/childhood-game/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Document
7 |
8 |
9 |
10 |
11 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/data-night-switch/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | height: 100vh;
3 | margin: 0;
4 | display: flex;
5 | align-items: center;
6 | justify-content: center;
7 | }
8 |
9 | .switch {
10 | font-size: 17px;
11 | position: relative;
12 | display: inline-block;
13 | width: 64px;
14 | height: 34px;
15 | }
16 |
17 | .switch input {
18 | opacity: 0;
19 | width: 0;
20 | height: 0;
21 | }
22 |
23 | .slider {
24 | position: absolute;
25 | cursor: pointer;
26 | top: 0;
27 | left: 0;
28 | right: 0;
29 | bottom: 0;
30 | background-color: #73C0FC;
31 | transition: .4s;
32 | border-radius: 30px;
33 | }
34 |
35 | .slider:before {
36 | position: absolute;
37 | content: "";
38 | height: 30px;
39 | width: 30px;
40 | border-radius: 20px;
41 | left: 2px;
42 | bottom: 2px;
43 | z-index: 2;
44 | background-color: #e8e8e8;
45 | transition: .4s;
46 | }
47 |
48 | .sun svg {
49 | position: absolute;
50 | top: 6px;
51 | left: 36px;
52 | z-index: 1;
53 | width: 24px;
54 | height: 24px;
55 | }
56 |
57 | .moon svg {
58 | fill: #73C0FC;
59 | position: absolute;
60 | top: 5px;
61 | left: 5px;
62 | z-index: 1;
63 | width: 24px;
64 | height: 24px;
65 | }
66 |
67 | @keyframes rotate {
68 |
69 | 0% {
70 | transform: rotate(0);
71 | }
72 |
73 | 100% {
74 | transform: rotate(360deg);
75 | }
76 | }
77 |
78 | .sun svg {
79 | animation: rotate 15s linear infinite;
80 | }
81 |
82 | @keyframes tilt {
83 |
84 | 0% {
85 | transform: rotate(0deg);
86 | }
87 |
88 | 25% {
89 | transform: rotate(-10deg);
90 | }
91 |
92 | 75% {
93 | transform: rotate(10deg);
94 | }
95 |
96 | 100% {
97 | transform: rotate(0deg);
98 | }
99 | }
100 |
101 | .moon svg {
102 | animation: tilt 5s linear infinite;
103 | }
104 |
105 | .input:checked + .slider {
106 | background-color: #183153;
107 | }
108 |
109 | .input:focus + .slider {
110 | box-shadow: 0 0 1px #183153;
111 | }
112 |
113 | .input:checked + .slider:before {
114 | transform: translateX(30px);
115 | }
116 |
--------------------------------------------------------------------------------
/data-night-switch/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Document
7 |
8 |
9 |
10 |
33 |
34 |
35 |