gpt4 book ai didi

html - CSS 随机 div 放置和响应

转载 作者:行者123 更新时间:2023-11-27 23:27:11 25 4
gpt4 key购买 nike

我创建了一个星夜动画,但想知道是否有人有更好的方法来仅使用 CSS“随机”放置 div???另外,我也很难响应。感谢您的时间!只是想学习。

http://codepen.io/anon/pen/MeeYWO?editors=1100 查看完整代码

#star-bl:nth-of-type(5) {
left: -350px;
top: 225px;
}

#star-bl:nth-of-type(6) {
left: 750px;
top: 250px;
}

#star-bl:nth-of-type(7) {
left: -450px;
}

#star-sm:nth-of-type(8) {
left: -225px;
}

#star-sm:nth-of-type(9) {
left: 500px;
}

#star-sm:nth-of-type(10) {
left: -100px;
}

最佳答案

目前在纯 CSS 中是不可能的(我希望 calc(rand) 成为一个东西)。您使用的解决方案与任何解决方案一样好,如果您希望星星聚集在较小的屏幕类型上,您可能需要考虑使用百分比。

关于html - CSS 随机 div 放置和响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37826300/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com