background属性
- background-color:指定要使用的背景颜色
- background-position:指定背景图像的位置
- background-size:指定背景图片的大小
- background-repeat:指定如何重复背景图像
- background-origin:指定背景图像的定位区域
- background-clip:指定背景图像的绘画区域
- background-attachment:设置背景图像是否固定或者随着页面的其余部分滚动
- background-image:指定要使用的一个或多个背景图像
1.background-position属性
属性值介绍:
- left top
left center
left bottom
right top
right center
right bottom
center top
center center
center bottom
- x% y% x是水平位置,y是垂直位置 左上角是0% 0%,右上角是100% 100%
- xpx ypx
- inherit 指定background-position属性设置应该从父元素继承
2. background-attachment属性
属性值介绍:
- scroll:背景图片随着页面的滚动而滚动,这是默认的。
- fixed:背景图片不会随着页面的滚动而滚动
- local:背景图片会随着元素内容的滚动而滚动
- ini