提示:如果需要在HTML页面上对背景图片进行图像平铺,可以使用background--repeat属性。
1、语法:
div{
background-repeat:"repeat-no";
}
background--------背景
repeat------------平铺
属性值:
1、repeat-------平铺
2、repeat-no--------不平铺
3、repeat-x----------x轴平铺
4、repeat-y----------y轴平铺
注意:
一般情况下默认不是平铺。
自己代码展示:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>背景平铺</title>
<style>
div {
width: 500px;
height: 250px;
background-image: url(image.jpg);
/* 这里“background-image”表示图片、后面有两个属性一个是:
none表示没有、
另一个表示url表示图片位置,这里位置分为相对路径和绝对路径 */
background-repeat: repeat-no;
/* 这里表示平铺背景:有四种属性值
第一种是:repeat表示平铺
第二种是:repeat-no表示不平铺
第三种是:repeat-x表示x方向平铺
第四种是:rcepeat-y表示y方向平铺 */
}
</style>
</head>
<body>
<div>小猪佩奇</div>
</body>
</html>
显示结果:
总结
提示:这里对文章进行总结:
例如:以上就是今天要讲的内容,本文仅仅简单介绍了如果需要在HTML页面上对背景图片进行图像平铺,可以使用background--repeat属性。