- 如果已经知道图片的宽高,那么最好在 img中写入宽高,这样可以让浏览器提前预留位置给这个图片,避免重排
<img src="" width="30" height="30" />
<div class="window">
<div class="image">
<img src="1.png" />
<img src="2.png" />
<img src="3.png" />
</div>
</div>
.window {width: 100px;height: 200px;}
.image > img {width: 100%;}
上面图片的宽度就是400, width: 100%,意思是 img的宽度与他的父级一样宽,而不是说填满他的父级,
那么img的父级是image,而image的宽度 与他的爸爸 winodw一样宽。