背景图像完全覆盖元素区域
作者:互联网
Examples
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>背景图像完全覆盖元素区域</title>
<style>
div{
margin:2px;
float:left;
border:1px solid red;
background:url(https://www.baidu.com/img/bd_logo1.png) no-repeat center;
background-size:cover; /*设计背景图像完全覆盖元素区域*/
}
.h1{
width:100px;
height:100px;
}
.h2{
width:384px;
height:240px;
}
</style>
</head>
<body>
<div class="h1"></div>
<div class="h2"></div>
</body>
</html>
效果图
标签:覆盖,元素,100px,height,width,background,图像 来源: https://www.cnblogs.com/sunr/p/16672849.html