I want to make an image layout with portrait images inside a div
with a fixed aspect ratio of 3:2
. The size of images is 327x491px
.
The main issue is unwanted spaces between images. How do I align images as a mosaic using only HTML/CSS?
HTML :
<div id="pictures1" class="_pictures1 grid">
<div class="_pictures1-01"><div style="width:125px;height: 188px; background: red;"><img src="" width="125" height="188" alt="" /></div></div>
<div class="_pictures1-02"><div style="width:192px;height: 288px;background: green;"><img src="" width="192" height="288" alt="" /></div></div>
... SO ON ...
</div>
CSS :
._pictures1 {
width: 935px; height: 490px;
margin: -26px 0 0 59px;
float: left;
top: 20%; left: 20%;
position: absolute;
border: 1px gray solid;
}
._pictures1 div {position: absolute;}
._pictures1-01 {top: 0px; left: 35px;}
._pictures1-02 {top: 200px; left: 0px;}
/* ... SO ON ... */
jsfiddle
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…