背景颜色
/* 背景颜色 */
background-color: aqua;
背景图片的引入
/* 背景图片 */
background-image:url(../img/观音山.png);
图片的平铺
/* 图片平铺 */
background-repeat: repeat;
/* 沿x轴平铺 沿y轴平铺 不平铺 */
/* background-repeat:repeat-x repeat-y no-repeat;
图片的移动
/* 背景图片的移动 右下角*/
background-position:right bottom;
center 上下左右居中
right top 右上
left top 左上
left bottom 左下
背景图片的固定
/* 背景图片的固定 */
background-attachment: fixed;
背景图片的大小
背景图片的大小
1.可以用百分比和像素进行设置
2.contain 按照比例放大图片,以最短的边为参照
3.cover 按照比例放大图片,以最长的边为参照物(空间不够会被裁剪)
background-size: contain;
背景的综合设置
背景属性的综合设置 background-size需要单独设置
background: green url() no-repeat 100px 100px fixed;
背景图片显示区域
背景图片开始平铺的位置
背景图片开始平铺的位置(默认图片是从padding开始平铺)
background-origin: padding-box;
背景图片开始从边框平铺
background-origin: border-box;
背景图片从内容开始平铺
background-origin: content-box;
背景图片结束的位置
背景图片从padding结束平铺
background-clip:padding-box ;
背景图片从border结束平铺
background-clip: border-box;
背景图片从content结束平铺
background-clip: content-box;
裁剪(除了文本)
background-clip: text;