<style>
body{
background-color: aliceblue;
background-image: url(image/bg22.png);
background-repeat: no-repeat;
background-position: top center;
background-attachment: fixed;
background: rgba(0,0,0,0.3);
}
</style>
background-color: 背景颜色
background-image: 图片位置
background-repeat: 插入的图片是否重复堆叠 ,可以是no-repeat repeat repeat-x repeat-y
background-position: 图片的位置,可以写top center left right buttom 等 顺序可以乱,但是如果要写精确位置,必须按照 x方向,y方向顺序写,例如12px 24px,表示图片距离左边边界12px,距离上面边界24px
background-attachment: fixed;滚动页面时,图片是否固定。scroll(滚动) fixed(固定)
background: rgba(0,0,0,0.3);第四个数字处在(0,1)之间设置透明度
也可以写的简单一点:
body{
background: aliceblue url(image/11.jpg) no-repeat top center fixed ;
}
顺序可以乱