css image list vertical align bottom
by kuyabiye
HTML
<ul class="photo-grid">
<li class="photo">
<a href="${photo-link}" class="photo-link">
<img src="http://lorempixel.com/200/150?1" class="photo-img" />
<span class="photo-title">Very very very very very very long</span>
</a>
</li><li class="photo">
<a href="${photo-link}" class="photo-link">
<img src="http://lorempixel.com/200/150?2" class="photo-img" />
<span class="photo-title">Test</span>
</a>
</li><li class="photo">
<a href="${photo-link}" class="photo-link">
<img src="http://lorempixel.com/200/150?3" class="photo-img" />
<span class="photo-title">Test</span>
</a>
</li><li class="photo">
<a href="${photo-link}" class="photo-link">
<img src="http://lorempixel.com/200/150?4" class="photo-img" />
<span class="photo-title">Test</span>
</a>
</li>
<li class="photo">
<a href="${photo-link}" class="photo-link">
<img src="http://lorempixel.com/150/200?5" class="photo-img" />
<span class="photo-title">Test</span>
</a>
</li><li class="photo">
<a href="${photo-link}" class="photo-link">
<img src="http://lorempixel.com/150/200?2" class="photo-img" />
<span class="photo-title">Test</span>
</a>
</li><li class="photo">
<a href="${photo-link}" class="photo-link">
<img src="http://lorempixel.com/200/150?3" class="photo-img" />
<span class="photo-title">Test</span>
</a>
</li><li class="photo">
<a href="${photo-link}" class="photo-link">
<img src="http://lorempixel.com/200/150?4" class="photo-img" />
<span class="photo-title">Test</span>
</a>
</li>
</ul>
CSS
.photo-grid {
list-style: none;
margin: 0;
padding: 0;
width: 830px;
}
.photo {
margin: 0 10px 10px 0;
display: inline-block;
vertical-align: bottom;
width: 200px;
text-align: center;
}
.photo:nth-child(4n) {
margin-right: 0;
}
.photo-link {
text-decoration: none;
}
.photo-img {
}
.photo-title {
display: block;
width: 200px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
color: #aaa;
}