<style>
.father {
width: 70%;
}
.daughter {
width: 90%; height: 0;
padding-bottom: 50%;
background: black;
}
</style>
<div class = "father">
<div class = "daughter">
<img src="...">
</div>
</div>
<style>
.father {
width: 70%;
}
.daughter {
width: 90%; height: 0;
padding-bottom: 50%;
background: black;
}
</style>
<div class = "father">
<div class = "daughter">
<img src="...">
</div>
</div>
本文标题:DIV高度随着宽度而变化
本文链接:https://www.haomeiwen.com/subject/sioouttx.html
网友评论