CSS 随机 div 放置和响应能力

use*_*940 5 html css animation responsive

我创建了一个星夜动画,但想知道是否有人有更好的方法来仅使用 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;
}
Run Code Online (Sandbox Code Playgroud)

But*_*uts 3

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