背景颜色
Background-color:背景颜色
<style>
body{
background-color:deeppink;
background-image:url("小可爱.jpg");
background-repeat:no-repeat;
background-position:center top;
}
</style>
background-color:背景色
background-image:设定背景图片,需要设置图片的URL地址
background-repeat:图片的复制选项
background-position: 位置
repeat:在水平和垂直两个方向上进行复制
no-report:不复制
repeat-x:在水平方向向上
repeat-y: 在水平方向向下
也可以将这一组属性值封装到一个属性background 中,书写顺序是:
背景色: background-color:
背景图片:设定背景图片
重复方式: background-repeat
位置:background-position
表达更加简洁
background: green url("小可爱.jpg") no-repeat right top;
尺寸相关属性
Height:高度
Width:宽度
Max-width:最大宽度
Max-height:最大高度
Max-width:最小宽度
Max-height:最小高度隐藏元素的方法:
visibility:hidden 仅仅是隐藏,该元素所占位置依然存在
display:none 不仅隐藏内容,还不占位置