学到了使用背景图片,随意看了几个css属性;
- background-color 设置背景的颜色
- background-image(url()) 添加背景图片,url() -=>填写要添加的图片路径
- background-repeat 是否平铺
- background-attachment 置背景图像是否固定或者随着页面的其余部分滚动
- background-position 背景定位
- background-size 背景图片的尺寸
- background-origin 背景图片的定位区域
- background-clip 背景的绘制区域
当然还有简写了,建议熟悉之后使用: background:background-color background-image background-repeat background-attachment background-position ;
其余三个background-size,background-origin,background-clip是要单独写的
实例: body { background: #00FF00 url(bgimage.gif) no-repeat fixed top; } 绿色背景,背景图片,不平铺,固定图片,图片顶部紧贴盒子顶部
注意: 元素的背景图片不受padding控制