如何正确设置样式以使img
内部图像div
没有底部水平“间隙”?在代码示例中,我试图消除图像之间的水平间隙。我尝试了 min/max -height 组合,但没有用。如何对照片进行无间隙的自适应排列?
#menu {
width:100%;
height:30px;
background: #E8DDCF;
border: solid 1px #E8DDCF;
}
#content {
margin-top: 2px;
display: inline-block;
width:100%;
background: #F3E7D8;
border: solid 1px #E8DDCF;
}
.f {
width: 98.4%;
height: 9%;
border: 1px solid #F3E7D8;
margin: 0 auto;
}
.f:hover {
border: 1px solid red;
}
.container {
position: relative;
width: 12.5%;
float: left;
}
.bottomleft {
position: absolute;
bottom: 5px;
left: 5px;
font-size: 11px;
color: blue;
}
<body>
<div id="menu"> </div>
<div id='content'>
<div id='fotos'>
<div class="container"><img class="f" src="http://party-boom.ru/catalog_photo/6018580s.png" alt="01"><div class="bottomleft">q</div></div>
<div class="container"><img class="f" src="http://party-boom.ru/catalog_photo/6018580s.png" alt="02"><div class="bottomleft">w</div></div>
<div class="container"><img class="f" src="http://party-boom.ru/catalog_photo/6018580s.png" alt="03"><div class="bottomleft">e</div></div>
<div class="container"><img class="f" src="http://party-boom.ru/catalog_photo/6018580s.png" alt="04"><div class="bottomleft">r</div></div>
<div class="container"><img class="f" src="http://party-boom.ru/catalog_photo/6018580s.png" alt="05"><div class="bottomleft">t</div></div>
<div class="container"><img class="f" src="http://party-boom.ru/catalog_photo/6018580s.png" alt="06"><div class="bottomleft">y</div></div>
<div class="container"><img class="f" src="http://party-boom.ru/catalog_photo/6018580s.png" alt="07"><div class="bottomleft">u</div></div>
<div class="container"><img class="f" src="http://party-boom.ru/catalog_photo/6018580s.png" alt="08"><div class="bottomleft">i</div></div>
<div class="container"><img class="f" src="http://party-boom.ru/catalog_photo/6018580s.png" alt="09"><div class="bottomleft">o</div></div>
<div class="container"><img class="f" src="http://party-boom.ru/catalog_photo/6018580s.png" alt="10"><div class="bottomleft">p</div></div>
</div>
</div>
</body>
添加
img{display: block; }
:响应图像。
这样缩进就没有问题了:
ps:
img { dispaly: inline-block; }
-默认line-height: 0
添加的另一个选项.container
像这样尝试