<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>网络悬浮球示例</title> <style> .floating-button { position: fixed; bottom: 20px; right: 20px; width: 50px; height: 50px; border-radius: 50%; background-color: #007bff; color: white; display: flex; justify-content: center; align-items: center; font-size: 16px; cursor: pointer; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); animation: jump 1s infinite; /* 应用动画 */ } /* 定义动画关键帧 */ @keyframes jump { 0%, 100% { transform: translateY(0); /* 起始和结束位置不变 */ } 50% { transform: translateY(-10px); /* 跳到上方10px的位置 */ } } /* 你可以添加hover效果来增加互动性 */ .floating-button:hover { background-color: #0056b3; /* 鼠标悬停时改变颜色 */ transform: scale(1.1); /* 稍微放大悬浮球 */ box-shadow: 0 6px 10px rgba(0, 0, 0, 0.2); /* 加深阴影效果 */ } </style> </head> <body> <div class="floating-button">点击我</div> </body> </html>
跳动悬浮球css
最新推荐文章于 2025-05-28 23:39:14 发布