css之颜色背景
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.c1 {
background-color: lightblue;
}
</style>
</head>
<body>
<div class="c1">大头</div>
</body>
</html>
图片背景填充
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.c1 {
background-color: lightblue;
}
.c2 {
width: 800px;
height: 800px;
background-image: url("https://image-1259117942.cos.ap-shanghai.myqcloud.com/CDN/medias/logo.png");
background-repeat: no-repeat;
}
</style>
</head>
<body>
<div class="c1">千里</div>
<div class="c2"></div>
</body>
</html>
图片居中
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.c1 {
background-color: lightblue;
}
.c2 {
border: 1px solid red;
width: 800px;
height: 800px;
background-image: url("https://image-1259117942.cos.ap-shanghai.myqcloud.com/CDN/medias/logo.png");
background-repeat: no-repeat;
/*background-position: 100px 200px;*/
background-position: center;
}
</style>
</head>
<body>
<div class="c1">千里</div>
<div class="c2"></div>
</body>
</html>