站长资讯网
最全最丰富的资讯网站

css3支持为网页添加多个背景图片吗

css3支持为网页添加多个背景图片。在css中,可以通过直接在background-image属性中指定多个背景路径来为网页添加多个背景图片,语法格式“background-image: url(图片地址), url(图片地址)…;”。

css3支持为网页添加多个背景图片吗

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

在CSS中使用多个背景图片

如果想在背景中添加一张以上的图片怎么办?CSS3 中可以直接 指定多个背景路径,如下所示:

body {   background-image: url(https://image.flaticon.com/icons/svg/748/748122.svg), url(https://images.unsplash.com/photo-1478719059408-592965723cbc?ixlib=rb-1.2.1&auto=format&fit=crop&w=2212&q=80);   background-position: center, top;   background-repeat: repeat, no-repeat;   background-size: contain, cover; }

效果图:

css3支持为网页添加多个背景图片吗

完整示例地址:https://codepen.io/duomly/pen/eYpVoJR

(学习视频分享:css视频教程)

赞(0)
分享到: 更多 (0)