div+css布局实现卡车行驶动画效果代码
代码语言:html
所属分类:动画
代码描述:div+css布局实现卡车行驶动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum=1.0,minimum=1.0,user-scalable=0" /> <style> .car-container { position: absolute; width: 400px; height: 400px; margin: auto; top: 0; bottom: 0; right: 0; left: 0; display: flex; justify-content: center; align-items: center; overflow: hidden; } .car { position: absolute; background-color: rgb(204, 204, 204); width: 200px; height: 120px; left: 50px; border-top: 4px solid rgb(162, 162, 162); top: 135px; animation: bounce 0.4s infinite; } @keyframes bounce { 0% { top: 135px; } 50% { top: 132px; } } .car::before { content: ""; position: absolute; width: 290px; height: 20px; background-color: rgb(46, 46, 81); bottom: -10px; } .car::after { content: ""; position: absolute; background-color: rgb(229, 229, 229); width: 80px; height: 90px; right: -90px; bottom: 10px; clip-path: polygon(0% 0%, 50% 0, 100% 60%, 100% 100%, 0% 100%); } .window { position: absolute; .........完整代码请登录后点击上方下载按钮下载查看
网友评论0