CSS背景图片

1.背景图片插入

代码格式:background-image:url(); 括号内填写图片路径

2.背景图片设置大小

代码格式:background-size:宽、高

3.背景图片设置不平铺

代码格式:background-repeat:no-repeat

由于背景图片插入后默认设置平铺效果,所以需使用该属性调整

4.背景图片定位

代码格式:background-position:方向(top/right/bottom/left)

5.背景图片固定

代码格式:background-attchment:fixed

猜你喜欢

转载自www.cnblogs.com/xsg1/p/9251797.html