CSS:随机分布的背景图片? [英] CSS: Randomly distributed background image?

查看:281
本文介绍了CSS:随机分布的背景图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站上有重复的背景图片.

I have a website with a repeated background image.

background: url(images/back_small.png) repeat center center fixed; 

但是,如果不重复复制一张图像,我会更想添加一些变化. 最终结果应该是一种点状图案,其中图像会不时出现,而不是立即重复出现.

I would like it more, however, if the image were not repeated one copy after an other, to add some variation. The final result should be a sort of a dotted pattern where the image appears now and then, instead of being instantly repeated.

我不知道CSS是否可以实现,但是如果可以...我正在等待:D

I have no idea if this is possible with CSS, but if so... I'm waiting for idea :D

推荐答案

我建议使用多背景技术的一种变体,在这种图像中,您可以根据质数来保存图像,并在其周围使用不同大小的透明空格".

I recommend using a variation of the multiple background technique where you save your image with differing sizes of transparent "space" around it based off prime numbers.

它被称为此网站上的蝉法则.

素数引入了随机性".当然,如果您不希望它们以任何方式重叠,那么您将需要非常精确地选择要使用的图像尺寸,以确保正常尺寸的显示器中不会出现直接重叠.

The prime numbers introduce the "randomness." Of course, if you do not want them to overlap in any way, then you will need to be very selective exactly what image sizes to use to insure no direct overlap occurs within a normal size monitor display.

这篇关于CSS:随机分布的背景图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆