1.背景色
使用 background-color属性为元素设置背景色
如果希望背景色从元素中的文本向外少有延伸,只需增加一些内边距
<style type = "text/css">
p{
background-color: rgb(0,255,255);
padding:20px;
}
</style>
颜色表达的方式:
rgb(1,1,1)
#00ffff
red(提供的常量)
可以为所有元素设置背景色,默认值为transparent:透明,
2.背景图像
使用background-image属性。默认值为none
<style type = "text/css">
body{
background-image: url("./img/2.png");
}
</style>
3.背景重复
background-repeat
4.背景定位
background-position :center;
5.背景关联
background-attachment :fixed;