2.1背景图片
★属性名: background-image (bgi)
★属性值: background-image: url( '图片的路径' );
★注意点:
·背景图片中urI中可以省略引号
·背景图片默认是在水平和垂直方向平铺的
·背景图片仅仅是指给盒子起到装饰效果,类似于背景颜色,是不能撑开盒子的
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
div{
width: 1920px;
height: 1080px;
background-color: pink;
background-image: url(./222.png);
}
</style>
</head>
<body>
<div>文字</div>
</body>
</html>