以下是一个使用HTML和CSS创建的动态跳动粉色爱心代码: ```html <!DOCTYPE html> <html> <head> <style> .heart { position: relative; width: 100px; height: 90px; margin: 100px auto; animation: heartbeat 1s infinite; } .heart:before, .heart:after { position: absolute; content: ""; left: 50px; top: 0; width: 50px; height: 80px; background: #ff66b2; border-radius: 50px 50px 0 0; transform: rotate(-45deg); transform-origin: 0 100%; } .heart:after { left: 0; transform: rotate(45deg); transform-origin: 100% 100%; } @keyframes heartbeat { 0% { transform: scale(1); } 25% { transform: scale(1.1); } 50% { transform: scale(1); } 75% { transform: scale(1.1); } 100% { transform: scale(1); } } </style> </head> <body> <div class="heart"></div> </body> </html> ``` 这段代码会: 1. 创建一个粉色的爱心形状(#ff66b2颜色) 2. 使用CSS动画让爱心有节奏地跳动 3. 跳动效果通过缩放变换实现 4. 动画无限循环 你可以调整以下参数来自定义效果: - 修改颜色代码#ff66b2改变爱心颜色 - 调整animation-duration改变跳动速度 - 修改transform: scale()值改变跳动幅度 [2025-05-06 16:52:30 | AI问答 | 383点数解答]