小月亮-动画
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>小太阳案例</title> <style type="text/css"> /*小太阳*/ * { margin: 0; padding: 0; } html,body { width: 100%; height: 100%; overflow: hidden; } .sun { width: 100px; height: 100px; margin:100px; position: relative; } .sun::before,.sun::after { content: ""; position: absolute; top: 50%; left: 50%; width: 50px; height: 50px; transform: translate(-50%,-50%); background-color: rgba(255,255,255,0.8); border-radius: 50%; animation: sun 2s infinite; } .sun::after { width: 80px; height: 80px; background: rgba(255,255,255,0.6); animation: sun 3s infinite; } @keyframes sun { 0% { transform: translate(-50%,-50%) scale(1); box-shadow: 0px 0px 5px rgba(255,255,255,0.7); } 50% { transform: translate(-50%,-50%) scale(1.1); box-shadow: 0px 0px 30px rgba(255,255,255,0.7); } 100% { transform: translate(-50%,-50%) scale(1); box-shadow: 0px 0px 5px rgba(255,255,255,0.7); } } </style> </head> <body> <div class="sun"></div> </body> </html>