There are many websites that have snow or petal-falling effects that look good. I will use JS to achieve this effect.
Before writing the code, you can first introduce bass.css to the style to do the processing;
1. HTML part
First create a folder, insert the following code in the body
2. CSS Section
body{ Background:url (img/bg.jpg) no-repeat Center Center; } . div{ position:fixed; } . roll{ Position:absolute; height:20px; Animation:mysnow 20s linear infinite; } @keyframes mysnow{ 0%{ bottom:100%; opacity:0; } 50%{ opacity:1; Transform:rotate (1080deg); } 100%{ opacity:0; bottom:0px; Transform:rotate (0deg); } }
3. js section
(function () {function snow (left, height, src) {var div = document.createelement ("div"); var img = document. CreateElement ("img"); Div.appendchild (IMG); Img.classname = "Roll"; IMG.SRC = src; Div.style.left = left + "px"; Div.style.height = height + "px"; Div.classname = "DIV"; document.getElementById ("Snowzone"). AppendChild (Div); SetTimeout (function () {document.getElementById ("Snowzone"). RemoveChild (Div); }, 50000); } setinterval (function () {var left=math.random () *window.innerwidth; var height=math.random () *window.innerheight;//gets the random height var src= "img/" + "s" +math.floor (Math.random () *2+1) + ". png"//Your diagram Address, put the picture under the IMG folder, including the background, snowflakes or petals, change the image name Snow (LEFT,HEIGHT,SRC); },500)}) ();
4, the top after the completion of their favorite falling effect will come out, you can also insert their favorite music.
Insert music just change the address and it's OK.
<embed src= "music/Winter Secrets-Zhou. mp3" autostart= "true" loop= "true" controls= "Smallconsole" hidden= "true" >
JS Snowflakes Falling