9.2 CSS 世界的 background
background 相关属性:
background-image、background-position、background-repeat、background-attachment、background-color: transparent;
如果是 IE9+浏览器,则还包括:
background-size、background-origin、background-clip;
9.2.2background-position
background-position:用来精确定位背景图出现的位置(从左上角 0 0 开始计量)。
值得范围:关键字(left、right、top、bottom、center)/偏移量(px,%);
9.2.3 background-repeat 与渲染性能
background-repeat表示定义background-image的重复呈现方式
repeat:水平和垂直两个方向都平铺图像(默认值)。
repeat-x:水平方向平铺图像。
repeat-y:垂直方向平铺图像。
no-repeat:图像不平铺,只呈现一次。
space:图像以相同的间距平铺且填满整个容器或某个方向。
round:图像自动缩放直至适应且填充满整个容器
9.2.4 background-attachment:fixed
background-attachment表示背景的附着方式(也可以说背景的滚动)。
scroll:默认值,背景图是相对于元素自身固定,元素移动背景图滚动
fixed:背景图相对于浏览器窗口(视口)固定
local:背景图是相对于元素里面的内容固定,元素中的内容移动背景图跟随移动
9.2.5 background-color 背景色
容器的背景色。
1.默认值:transparent,不具备继承性。
2.当与background-image同时定义时,色永远被图覆盖。
background 相关属性:
background-image、background-position、background-repeat、background-attachment、background-color: transparent;
如果是 IE9+浏览器,则还包括:
background-size、background-origin、background-clip;
9.2.2background-position
background-position:用来精确定位背景图出现的位置(从左上角 0 0 开始计量)。
值得范围:关键字(left、right、top、bottom、center)/偏移量(px,%);
9.2.3 background-repeat 与渲染性能
background-repeat表示定义background-image的重复呈现方式
repeat:水平和垂直两个方向都平铺图像(默认值)。
repeat-x:水平方向平铺图像。
repeat-y:垂直方向平铺图像。
no-repeat:图像不平铺,只呈现一次。
space:图像以相同的间距平铺且填满整个容器或某个方向。
round:图像自动缩放直至适应且填充满整个容器
9.2.4 background-attachment:fixed
background-attachment表示背景的附着方式(也可以说背景的滚动)。
scroll:默认值,背景图是相对于元素自身固定,元素移动背景图滚动
fixed:背景图相对于浏览器窗口(视口)固定
local:背景图是相对于元素里面的内容固定,元素中的内容移动背景图跟随移动
9.2.5 background-color 背景色
容器的背景色。
1.默认值:transparent,不具备继承性。
2.当与background-image同时定义时,色永远被图覆盖。