背景:
background-image:url(img/名字)
background-repeat:no repeat 不重复
repeat-x 图像占一横排
repeat-y 图像占一竖排
背景的偏移与定位:
background-position: 背景图片的开始位置,默认都是0% 0%
top left
bottom center;
center center;
left; (只写一个,后面的值默认是center)
100px,120px 水平100,垂直120
负值 反方向移动
background-attachment:默认页面滚动
fixed 固定,不动
head中设一个body{}--全部
按钮练习:
.btn:link{
display:block; (转换成块元素)
width:超链接图片宽
height:超链接图片高
background-image:url{img/1.png}
background-repeat:no repeat
}
.btn:hover{
background-image:url(img/hover.png)
>/图片整合技术(多张图片合成一张,提高加载速度)/
background-position:-图片宽px 0px
}
.btn:active{
background-image:url(img/active.png)
}
网友评论