【发布时间】:2017-04-11 00:17:52
【问题描述】:
我的画廊看起来像这样:https://drive.google.com/open?id=0BwBGhbPaJU_jdUl3cGdNQjVNVjg
正如您所见,这是我的画廊,我希望图片下方和图片之间的空格消失。 (箭头所示)
这是我的代码:
/*Gallery*/
#works-gallery{
margin:0px;
position:relative;
top:900px;
width:1440;
text-align:center;
line-height: 0;
column-count: auto;
column-gap:0px;
-webkit-column-count:auto;
-webkit-column-gap:0px;
-moz-column-count:auto;
-moz-column-gap:0px;
}
#works-gallery img {
postion:relative;
display:inline-block;
width:480px;
height:auto;
top:0px;
vertical-align:top;
padding:0px;
border:0px;
}
<div id="works-gallery">
<img src="http://lorempixel.com/480/320/abstract" class="tile" /><img src="http://lorempixel.com/480/456/city" class="tile" /><img src="http://lorempixel.com/480/456/city" class="tile" />
<td><img src="http://lorempixel.com/480/234/fashion" class="tile" /><img src="http://lorempixel.com/480/567/food" class="tile" /><img src="http://lorempixel.com/480/356/nature" class="tile" />
<img src="http://lorempixel.com/480/678/nightlife" class="tile" /><img src="http://lorempixel.com/480/243/people" class="tile" /><img src="http://lorempixel.com/480/678/sports" class="tile" />
<img src="http://lorempixel.com/480/256/technics" class="tile" /><img src="http://lorempixel.com/480/678/transport" class="tile" /><img src="http://lorempixel.com/480/235/abstract" class="tile" />
<img src="http://lorempixel.com/480/678/animals" class="tile" /><img src="http://lorempixel.com/480/657/city" class="tile" /><img src="http://lorempixel.com/480/789/fashion" class="tile" />
</div>
请问我要改什么?
【问题讨论】:
-
那是因为你的图片有不同的纵横比。您愿意拉伸这些风景照片以适合您的肖像照片吗?
-
如果你想拥有不同大小的元素,你必须手动移动每个位置。
-
@JkAlombro 不,我想保持原始纵横比
标签: javascript html css image-gallery