fixed的left:50%,漂浮

.floor-box{width: 44px; border: 1px solid #ccc; position: fixed; left: 50%; z-index: 1000}

漂浮距离,距中间50%

.floor-box{width: 44px; border: 1px solid #ccc; position: fixed; left: 50%; margin-left: 620px; bottom: 30px; background: #fff; z-index: 1000}

漂浮距离:距离中间50%,在减去620px

转载于:https://www.cnblogs.com/wesky/p/4846546.html

好的,这是一个使用 HTML、CSS 和 JavaScript 的静态新年快乐页面的例子: ```html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>新年快乐</title> <style> /* 在这里添加你的 CSS 样式 */ body { background-color: #FEE600; /* 设置黄色背景 */ } .fireworks { position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; } .fireworks img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; } .lanterns { display: flex; justify-content: center; align-items: center; height: 50%; } .lantern { width: 100px; height: 100px; border-radius: 50%; background-color: red; box-shadow: 0 0 10px 5px orange; } .greetings { position: fixed; bottom: 0; left: 0; width: 100%; text-align: center; font-size: 2em; color: white; text-shadow: 0 0 10px 5px orange; } </style> </head> <body> <!-- 在这里添加你的 HTML 元素 --> <div class="fireworks"> <img src="fireworks.gif" alt="fireworks"> </div> <div class="lanterns"> <div class="lantern"></div> <div class="lantern"></div> <div class="lantern"></div> </div> <div class="greetings"> 春节快乐! </div> <!-- 在这里添加你的 JavaScript 代码 --> <script> // 漂浮滚动的祝福语 const greetings = document.querySelector('.greetings'); let top = 0; setInterval(() => { greetings.style.top = `${top}px`; top -= 1; if (top < -greetings.offsetHeight) { top = window.innerHeight; } }, 50); </script> </body> </html> ``` 这个例子中使用了一张烟花 GIF 图片来作为
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值