背景图设置
#bg{
background-image:url(https://hzjimanke.com/web/statics/images/dona/dona12.png);
background-size:100% 100%;
background-repeat:repeat-x / repeat-y / no-repeat / repeat;
background-attachment : scroll | fixed;
}
css样式 | 作用 |
---|---|
background-image | 设置背景图,url里不加引号 |
background-size | 设置背景图大小 |
background-repeat | 如何重复背景图像 |
background-attachment | 背景图滚动/固定 |
背景图位置
方法一
background-position : 距离左边的距离 || 距离上边的距离(百分数 | 长度值)
方法二
background-position : position || position (top | center | bottom | left | center | right 方位名词)
背景透明
方法一
opacity:0.5;(0是全透明 1是完全不透明)
方法二
background-color:rgba(255,255,255,0.5);