关于云朵的进入和消失
我写的代码实现不了案例中的效果,请老师告诉我怎么改进。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | <!DOCTYPE html> < html lang = "en" > < head > < meta charset = "UTF-8" > < meta name = "viewport" content = "width=device-width, initial-scale=1.0" > < meta http-equiv = "X-UA-Compatible" content = "ie=edge" > < title >Document</ title > < style > body{ margin: 0; padding: 0; overflow: hidden; } .sky{ width: 100%; height: 60vh; /* background: rgb(196, 228, 253) */ background: linear-gradient(0deg, #fff , rgb(196, 228, 253)) } .grass{ width: 100%; height: 40vh; /* background: rgb(148, 190, 89) */ background: linear-gradient(0deg, rgb(148, 190, 89), #fff) } .rabbit{ width: 300px; height: 300px; position: absolute; bottom: 50px; right: 150px; background: url(./rabbit.png) no-repeat center; background-size: 100% } .cloud{ width: 100px; height: 100px; background: #fff; position: relative; left: 100px; border-radius: 50%; } .cloud::before{ content: ''; position: absolute; left: -80px; bottom: 5px; width: 190px; height: 50px; background: #fff; border-radius: 25px 25px 30px 30px/ 25px 25px 25px 25px; } .cloud::after{ content: ''; position: absolute; left: -49px; bottom: -12px; width: 70px; height: 95px; background: #fff; border-radius: 35px / 35px 35px 35px 35px; transform: rotate(-45deg) } .cloud.one{ position: absolute; top: 0px; left: 80px; transform: scale(.7, .7); z-index: 7; opacity: .7; } .cloud.two{ position: absolute; top: 100px; left: 300px; z-index: 9; opacity: .9; animation: cloud_two 5s linear infinite; /* transform: translateX(0px) */ } .cloud.three{ position: absolute; top: 200px; left: 250px; z-index: 8; opacity: .8; transform: scale(.8, .8) } .cloud.four{ position: absolute; top: 0px; left: 650px; z-index: 8; opacity: .8; transform: scale(.8, .8) } .cloud.five{ position: absolute; top: 200px; left: 800px; z-index: 7; opacity: .7; transform: scale(.7, .7) } @keyframes cloud_two { from{ left: 300px; /* transform: translateX(0px) */ } 50%{ left: -300px /* transform: translateX(2000px) */ } to{ left: 2000px /* transform: translateX(-200px) */ } } </ style > </ head > < body > < div class = "sky" > < div class = "cloud one" ></ div > < div class = "cloud two" ></ div > < div class = "cloud three" ></ div > < div class = "cloud four" ></ div > < div class = "cloud five" ></ div > </ div > < div class = "grass" ></ div > < div class = "rabbit" ></ div > </ body > </ html > |
3
收起
正在回答 回答被采纳积分+1
1回答
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧