重复css的背景图像设置次数 [英] repeat css background image a set number of times

查看:420
本文介绍了重复css的背景图像设置次数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法设置背景图片用css重复的次数?

解决方案

一个丑陋的黑客可能(使用多个背景)多次插入多个图片: / p>

例如要三次水平重复图片(80x80):

  background-image:url('bg_texture.png'),
url('bg_texture.png'),
url('bg_texture.png');
background-repeat:no-repeat,
no-repeat,
no-repeat;
background-position:0 top,
80px top,
160px top;

注意:在9以下版本的IE下无法使用( source )。


is there a way to set the number of times a background image repeats with css?

解决方案

An ugly hack could be inserting multiple times —statically— the same image (using multiple backgrounds):

E.g. To repeat horizontally an image (80x80) three times:

background-image: url('bg_texture.png'), 
                  url('bg_texture.png'),
                  url('bg_texture.png');
background-repeat: no-repeat, 
                   no-repeat,
                   no-repeat;
background-position: 0 top, 
                     80px top,
                     160px top;

Beware: not working on IE under 9 version (source).

这篇关于重复css的背景图像设置次数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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