我们首先来看一下css设置背景图片平铺方式。
repeat:即默认方式,完全平铺背景;
no-repeat:在X及Y轴方向均不平铺;
repeat-x:横向平铺背景;
repeat-y:纵向平铺背景。
下面我们就来看一下css的这四种背景图片平铺的实现代码。
css背景图片平铺之完全平铺背景的代码:
<html>
<head>
<style type="text/css">
#content {
border:1px solid #000fff;
height:500px;
background-image:url(http://img12.3lian.com/gaoqing02/01/58/85.jpg);
background-repeat: no-repeat;
}
</style>
<div id="content">
</div>
</body>
</html>css背景图片平铺效果如下:

css背景图片平铺之在X及Y轴方向均不平铺:
<html>
<head>
<style type="text/css">
#content {
border:1px solid #000fff;
height:500px;
background-image:url(images/tu.jpg);
background-repeat: no-repeat;
}
</style>
<div id="content">
</div>
</body>
</html>css背景在X及Y轴方向均不平铺效果如下:

css背景图片平铺之横向平铺背景:
背景图片现在只在X轴即横向进行了平铺操作,纵向并没有进行平铺
<html>
<head>
<style type="text/css">
#content {
border:1px solid #000fff;
height:500px;
background-image:url(images/tu.jpg);
background-repeat: repeat-x;
}
</style>
<div id="content">
</div>
</body>
</html>css横向平铺背景效果如下:

css背景图片平铺之纵向平铺背景:
背景图片现在只在Y轴即横向进行了平铺操作,横向并没有进行平铺
<html>
<head>
<style type="text/css">
#content {
border:1px solid #000fff;
height:500px;
background-image:url(images/tu.jpg);
background-repeat: repeat-y;
}
</style>
<div id="content">
</div>
</body>
</html>css纵向平铺背景效果如下:

以上就是本篇文章的全部内容了,更多精彩内容可以关注php中文网。
以上就是css如何让背景图片平铺?css背景图片平铺四种方式介绍的详细内容,更多请关注php中文网其它相关文章!
……