如何设置jQuery使背景图片不重复?
- 内容介绍
- 文章标签
- 相关推荐
本文共计477个文字,预计阅读时间需要2分钟。
两种让背景图片不重复的方法:
1.使用CSS给元素添加`background-repeat`属性,语法:`$(指定元素).css('background-repeat', 'no-repeat');`
2.使用attr()给元素添加`background-repeat`样式,语法:`$(指定元素).attr('style', 'background-repeat: no-repeat;');`
两种让背景图片不重复的方法:1、用css()给元素添加background-repeat属性,语法“$("指定元素").css("background-repeat","no-repeat")”。2、用attr()给元素添加background-repeat样式,语法“$("指定元素").attr("style","background-repeat:no-repeat")”。
本教程操作环境:windows7系统、jquery3.6.0版本、Dell G3电脑。
jquery让背景图片不重复的两种方法
方法1:使用css()添加background-repeat属性
css() 可以设置匹配的元素的一个或多个样式属性。
本文共计477个文字,预计阅读时间需要2分钟。
两种让背景图片不重复的方法:
1.使用CSS给元素添加`background-repeat`属性,语法:`$(指定元素).css('background-repeat', 'no-repeat');`
2.使用attr()给元素添加`background-repeat`样式,语法:`$(指定元素).attr('style', 'background-repeat: no-repeat;');`
两种让背景图片不重复的方法:1、用css()给元素添加background-repeat属性,语法“$("指定元素").css("background-repeat","no-repeat")”。2、用attr()给元素添加background-repeat样式,语法“$("指定元素").attr("style","background-repeat:no-repeat")”。
本教程操作环境:windows7系统、jquery3.6.0版本、Dell G3电脑。
jquery让背景图片不重复的两种方法
方法1:使用css()添加background-repeat属性
css() 可以设置匹配的元素的一个或多个样式属性。

