您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

css怎样让背景图片不平铺

2025/3/11 21:32:25发布21次查看
在css中,可以利用“background-repeat”属性让背景图片不平铺,该属性用于设置背景图片的平铺模式,只需要给元素添加“background-repeat:no-repeat;”样式,即可让背景图片不平铺显示。
本教程操作环境:windows10系统、css3&&html5版、dell g3电脑。
css怎样让背景图片不平铺
在css中可以利用background-repeat属性设置背景图片不平铺,background-repeat 属性设置是否及如何重复背景图像。默认地,背景图像在水平和垂直方向上重复。background-repeat 属性定义了图像的平铺模式。
其中属性值如下图:
下面我们通过示例来看一下:
<!doctype html><html lang="en"><head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>document</title> <style> body{ background-image: url(1118.02.png);}</style></head><body> </body></html>
输出结果:
添加不平铺样式之后:
<!doctype html><html lang="en"><head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>document</title> <style> body{ background-image: url(1118.02.png);background-repeat: no-repeat;}</style></head><body></body></html>
输出结果:
(学习视频分享:css视频教程)
以上就是css怎样让背景图片不平铺的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product