Home > Article > Web Front-end > 纯css3流星雨_html/css_WEB-ITnose
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>meteor</title> 6 <style> 7 *{ 8 padding:0; 9 margin:0; 10 } 11 body{ 12 background-color:#000; 13 overflow:hidden; 14 } 15 .author{ 16 color:#fff; 17 font:18px/1.5 "微软雅黑"; 18 animation:change 4s infinite; 19 } 20 .star{ 21 width:4px; 22 height:4px; 23 background-color:#fff; 24 display:block; 25 position:absolute; 26 top:110px; 27 right:800px; 28 border-radius:4px; 29 animation:star 1s infinite linear; 30 opacity:0; 31 } 32 .star:after{ 33 position:relative; 34 display:block; 35 top:-49px; 36 left:23px; 37 border:2px solid #fff; 38 border-width:0 0 0 1px; 39 width:100px; 40 height:100px; 41 content:""; 42 transform:rotate(45deg); 43 } 44 .blue{ 45 background-color:lightskyblue; 46 top:60px; 47 right:600px; 48 animation-delay:0.25s; 49 } 50 .blue:after{ 51 width:200px; 52 height:200px; 53 top:-99px; 54 left:43px; 55 border:2px solid lightskyblue; 56 border-width:0 0 0 1px; 57 } 58 .pink{ 59 background-color:lightpink; 60 top:160px; 61 right:500px; 62 animation:starPink 1s infinite linear; 63 animation-delay:0.5s; 64 } 65 .pink:after{ 66 width:133px; 67 height:133px; 68 top:-65px; 69 left:29px; 70 border:2px solid lightpink; 71 border-width:0 0 0 1px; 72 } 73 .yellow{ 74 background-color:yellow; 75 top:127px; 76 right:261px; 77 animation:starYellow 1s infinite linear; 78 animation-delay:0.75s; 79 } 80 .yellow:after{ 81 width:209px; 82 height:164px; 83 top:-65px; 84 left:29px; 85 border:2px solid yellow; 86 border-width:0 0 0 1px; 87 } 88 @keyframes change{ 89 0%{ 90 color:#fff; 91 } 92 25%{ 93 color:lightskyblue; 94 } 95 50%{ 96 color:lightpink; 97 } 98 75%{ 99 color:yellow;100 }101 }102 @keyframes star{103 0%{104 opacity:0;105 transform:scale(0) translate(0,0);106 }107 50%{108 opacity:1;109 transform:scale(1) translate(-200px,200px);110 }111 100%{112 opacity:0;113 transform:scale(1) translate(-400px,400px);114 }115 }116 @keyframes starPink{117 0%{118 opacity:0;119 transform:scale(0) translate(0,0);120 }121 50%{122 opacity:1;123 transform:scale(1) translate(-300px,300px);124 }125 100%{126 opacity:0;127 transform:scale(1) translate(-600px,600px);128 }129 }130 @keyframes starYellow{131 0%{132 opacity:0;133 transform:scale(0) translate(0,0);134 }135 50%{136 opacity:1;137 transform:scale(1) translate(-300px,300px);138 }139 100%{140 opacity:0;141 transform:scale(1) translate(-600px,600px);142 }143 }144 </style>145 </head>146 <body>147 <span class="author">by Scott</span>148 <span class="star"></span>149 <span class="star blue"></span>150 <span class="star pink"></span>151 <span class="star yellow"></span>152 </body>153 </html>
demo 链接:http://wangpengfei15975.github.io/MyBlog