测试用例
html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>菜鸟教程</title>
<style type="text/css">
.zoomImage {
width: 100%;
height: 0;
padding-bottom: 100%;
overflow: hidden;
background-position: center center;
background-repeat: no-repeat;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
}
.h1w1 {
width: 100%;
height: 0;
padding-bottom: 100%;
}
.w4h3 {
width: 100%;
height: 0;
padding-bottom: 75%;
}
.w3h4 {
width: 100%;
height: 0;
padding-bottom: 133.33%;
}
.father {
width: 150px;
background-color: rgb(199, 212, 224);
margin: 20px 20px 0 0;
border: 2px solid #cccccc;
box-sizing: border-box;
}
.origin {
margin: 20px 20px 0 0;
}
</style>
</head>
<body>
<div style="display: flex;">
<div>
<div class="origin">
<img src="../../assets/正方形.png" width="150px" />
</div>
<p>
原素材 宽=高
</p>
👇 1:1 | 4:3 | 3:4
<div class="father">
<div class="zoomImage h1w1" style="background-image:url(../../assets/正方形.png)">
</div>
</div>
<div class="father">
<div class="zoomImage w4h3" style="background-image:url(../../assets/正方形.png)">
</div>
</div>
<div class="father">
<div class="zoomImage w3h4" style="background-image:url(../../assets/正方形.png)">
</div>
</div>
</div>
<div>
<div class="origin">
<img src="../../assets/宽.png" width="150px" />
</div>
<p>
原素材 宽>高
</p>
👇 1:1 | 4:3 | 3:4
<div class="father">
<div class="zoomImage h1w1" style="background-image:url(../../assets/宽.png)">
</div>
</div>
<div class="father">
<div class="zoomImage w4h3" style="background-image:url(../../assets/宽.png)">
</div>
</div>
<div class="father">
<div class="zoomImage w3h4" style="background-image:url(../../assets/宽.png)">
</div>
</div>
</div>
<div>
<div class="origin">
<img src="../../assets/高.png" width="150px" />
</div>
<p>
原素材 宽<高
</p>
👇 1:1 | 4:3 | 3:4
<div class="father">
<div class="zoomImage h1w1" style="background-image:url(../../assets/高.png)">
</div>
</div>
<div class="father">
<div class="zoomImage w4h3" style="background-image:url(../../assets/高.png)">
</div>
</div>
<div class="father">
<div class="zoomImage w3h4" style="background-image:url(../../assets/高.png)">
</div>
</div>
</div>
</div>
</body>
</html><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>菜鸟教程</title>
<style type="text/css">
.zoomImage {
width: 100%;
height: 0;
padding-bottom: 100%;
overflow: hidden;
background-position: center center;
background-repeat: no-repeat;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
}
.h1w1 {
width: 100%;
height: 0;
padding-bottom: 100%;
}
.w4h3 {
width: 100%;
height: 0;
padding-bottom: 75%;
}
.w3h4 {
width: 100%;
height: 0;
padding-bottom: 133.33%;
}
.father {
width: 150px;
background-color: rgb(199, 212, 224);
margin: 20px 20px 0 0;
border: 2px solid #cccccc;
box-sizing: border-box;
}
.origin {
margin: 20px 20px 0 0;
}
</style>
</head>
<body>
<div style="display: flex;">
<div>
<div class="origin">
<img src="../../assets/正方形.png" width="150px" />
</div>
<p>
原素材 宽=高
</p>
👇 1:1 | 4:3 | 3:4
<div class="father">
<div class="zoomImage h1w1" style="background-image:url(../../assets/正方形.png)">
</div>
</div>
<div class="father">
<div class="zoomImage w4h3" style="background-image:url(../../assets/正方形.png)">
</div>
</div>
<div class="father">
<div class="zoomImage w3h4" style="background-image:url(../../assets/正方形.png)">
</div>
</div>
</div>
<div>
<div class="origin">
<img src="../../assets/宽.png" width="150px" />
</div>
<p>
原素材 宽>高
</p>
👇 1:1 | 4:3 | 3:4
<div class="father">
<div class="zoomImage h1w1" style="background-image:url(../../assets/宽.png)">
</div>
</div>
<div class="father">
<div class="zoomImage w4h3" style="background-image:url(../../assets/宽.png)">
</div>
</div>
<div class="father">
<div class="zoomImage w3h4" style="background-image:url(../../assets/宽.png)">
</div>
</div>
</div>
<div>
<div class="origin">
<img src="../../assets/高.png" width="150px" />
</div>
<p>
原素材 宽<高
</p>
👇 1:1 | 4:3 | 3:4
<div class="father">
<div class="zoomImage h1w1" style="background-image:url(../../assets/高.png)">
</div>
</div>
<div class="father">
<div class="zoomImage w4h3" style="background-image:url(../../assets/高.png)">
</div>
</div>
<div class="father">
<div class="zoomImage w3h4" style="background-image:url(../../assets/高.png)">
</div>
</div>
</div>
</div>
</body>
</html>
liang14658fox