css实现不规则图片等宽高展示
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>css实现不规则图片等宽高展示</title>
<style>
.image-box{
position:relative;
width:100%;
height:0;
padding-top:100%;
}
.image-box img{
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
}
</style>
</head>
<body>
<div style="width:200px;">
<div class="image-box">
<img src="img/1.png">
</div>
</div>
</body>
</html>
本文标题:css实现不规则图片等宽高展示
本文链接:https://www.haomeiwen.com/subject/wzojiftx.html
网友评论