I'm trying to fill containers with images but i can't find the solution.
If images are too short, I need to make them full height, but they can overflow the sides. If images are too narrow, I need to make them full width, but they can overflow the bottom.
<div class="cb-img-fw four-image">
<a href="postURL"><img src="imageURL"></a>
</div>
and current css
.four-grid-post > .four-image{
max-height: 184px;
max-width: 271px;
overflow: hidden;
}
.four-grid-post > .four-image img{
min-width: 100%;
max-width: 100%;
height: auto;
}
I'm also open to jQuery solutions, but my content loads with ajax so it might cause some problems.