找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索本站精品资源

首页 教程频道 查看内容

css如何设置背景图片不平铺

作者:模板之家 2021-4-11 14:52 112人关注

方法:1、使用background-attachment属性,语法“background-attachment:fixed”;2、使用background-repeat属性,语法“background-repeat:no-repeat”。

方法:1、使用background-attachment属性,语法“background-attachment:fixed”;2、使用background-repeat属性,语法“background-repeat:no-repeat”。

本教程操作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。

背景图片不重复不平铺,可以这样设定背景:

1、这样背景图片就会固定住,不会因页面滚动而重复。

<body style="background-image: url("图片文件地址"); background-attachment: fixed;">

2、使图在任何大小的屏幕都不会显示重复,可以这样设定背景(图像不平铺):

<body style="background-image: url("图片文件地址"); background-repeat:no-repeat;">

推荐学习:css视频教程

以上就是css如何设置背景图片不平铺的详细内容,更多请关注模板之家(www.mb5.com.cn)其它相关文章!


路过

雷人

握手

鲜花

鸡蛋
来自: 网络收集

全部回复(0)