当前位置 : 主页 > 网页制作 > css >

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

来源:互联网 收集:自由互联 发布时间:2023-08-02
方法:1、使用background-attachment属性,语法“background-attachment:fixed”;2、使用background-repeat属性,语法“background-repeat:no-repeat”。 本教程操作环境:windows7系统、CSS3HTML5版、Dell G3电脑。

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

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

本教程操作环境: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怎么去掉input边框
下一篇:没有了
网友评论