<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>
.box{
width: 300px;
/* 宽度300px,px是像素 */
height: 300px;
/* 宽度300px,px是像素 */
/* 背景色 */
background-color: red;
/* 颜色的三种定义方法: */
/* 1直接定义法:直接打对应的英文单词 */
/* 2 16进制法:#fffff */
/* 3三原色定义法:rgb(100,110,100) */
/* 背景图 */
background-image: url("图片的路径");
/* 注:如果背景图不足以覆盖整个元素,则使自己重复,以至于铺满整个元素 */
/* 背景图的重复方式 */
background-repeat: no-repeat;
/* 不重复 */
background-repeat: repeat-x;
/* 水平重复 */
background-repeat: repeat-y;
/* 垂直重复 */
/* 背景图的位置 */
background-position: 水平位置 垂直位置;
/* 水平位置有三个关键词:left;center;right; */
/* 垂直位置有三个关键词:top;center;bottom; */
/* 位置也可以写像素,水平是向右走,垂直是向下走 */
}
</style>
</head>
<body>
<div class="box">
</div>
</body>
</html>