CSS Need tips for Gallery layout [closed] - html

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Some of the layouts I have been tasked with converting utilize the following layout (see image.) I'm wondering what the best way using CSS is to render a list of images accordingly. I don't want to split up the items into different row containers just to make things fit. I'm sure there's a way to create this a list.
The biggest problem I have is rendering the images with the appropriate margins in-between and having the far right image line up with the edge of the layout container (orange lines.)
Ideally, I'd like to maintain the html as something like:
<ul class="gallery-list">
<li class="gallery-list-item">
<img src="..." alt="..." />
</li>
<li class="gallery-list-item">
<img src="..." alt="..." />
</li>
</ul>
Thanks for your time and if there is a better solution, I'd be happy to close this and link to the solution.

This might be a solution, it might not. It makes a few assumptions like there always being four images per row but making them responsive.
The main points are:
We set the image container width a percentage of the parent container to control the number of images per row.
We use a right negative margin on the ul to offset the right margin applied to the li for image spacing.
We use calc to subtract the margin we use for spacing so all elements will fit on a single line and not begin to reflow.
I've used a couple media queries to show how you would change row count for smaller screens to make the grid responsive.
There's also a bit of padding and border applied to .container to demonstrate that the images are taking up the full width of the container.
This is just one way to do things.
body {
margin: 0;
}
ul,
li {
margin: 0;
padding: 0;
list-style: none;
}
.container {
width: 80%;
margin: 50px auto;
/* following adding for demo purposes */
padding: 50px 0;
border-left: 1px solid #CCC;
border-right: 1px solid #CCC;
overflow: hidden;
}
ul {
margin-right: -5px;
}
li {
float: left;
margin: 0 5px 5px 0;
width: calc( 50% - 5px );
}
img {
display: block;
width: 100%; /* or max-width: 100%; */
height: auto;
}
#media( min-width: 550px ) {
li {
width: calc( 33.333% - 5px );
}
}
#media( min-width: 750px ) {
li {
width: calc( 25% - 5px );
}
}
<div class="container">
<ul>
<li>
<img src="http://placehold.it/200x200/fc0/&text=1">
</li>
<li>
<img src="http://placehold.it/200x200/ccc/&text=2">
</li>
<li>
<img src="http://placehold.it/200x200/fc0/&text=3">
</li>
<li>
<img src="http://placehold.it/200x200/ccc/&text=4">
</li>
<li>
<img src="http://placehold.it/200x200/fc0/&text=5">
</li>
<li>
<img src="http://placehold.it/200x200/ccc/&text=6">
</li>
<li>
<img src="http://placehold.it/200x200/fc0/&text=7">
</li>
<li>
<img src="http://placehold.it/200x200/ccc/&text=8">
</li>
</ul>
</div>

There are a lot of ways you could go about this. I'm partial to flexbox - this example shows it with a fixed width on the gallery, but you can use a fluid one as well. I'd recommend doing some reading about flexbox, but here's a starting place:
.gallery {
display: flex;
flex-wrap: wrap;
width: 440px;
margin: auto;
padding: 0;
list-style: none;
}
.gallery img {
margin-right: 10px;
margin-bottom: 10px;
}
<ul class="gallery">
<li>
<img src="//placehold.it/100x100" alt="Artwork">
</li>
<li>
<img src="//placehold.it/100x100" alt="Artwork">
</li>
<li>
<img src="//placehold.it/100x100" alt="Artwork">
</li>
<li>
<img src="//placehold.it/100x100" alt="Artwork">
</li>
<li>
<img src="//placehold.it/100x100" alt="Artwork">
</li>
<li>
<img src="//placehold.it/100x100" alt="Artwork">
</li>
<li>
<img src="//placehold.it/100x100" alt="Artwork">
</li>
<li>
<img src="//placehold.it/100x100" alt="Artwork">
</li>
<li>
<img src="//placehold.it/100x100" alt="Artwork">
</li>
<li>
<img src="//placehold.it/100x100" alt="Artwork">
</li>
</ul>

You can also use display:flex and flex-wrap for this
I have changed markup from ul li's to div and img's and i have let the last image for every row to grow and fit the container
check this snippet
.gallery-list-item {
display: flex;
width: 100%;
margin-top: 10px;
}
div img:not(:first-child) {
margin-left: 10px;
}
div.gallery-list-item img:last-child {
flex: 1;
}
div.gallery-list {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
width: 450px;
border: 1px solid black;
padding: 0;
}
<div class="gallery-list">
<div class="gallery-list-item">
<img src="http://shushi168.com/data/out/123/36699123-images.png" alt="..." height=100 width=100/>
<img src="http://i164.photobucket.com/albums/u8/hemi1hemi/COLOR/COL9-6.jpg" alt="..." height=100 width=100/>
<img src="http://shushi168.com/data/out/123/36699123-images.png" alt="..." height=100 width=100/>
<img src="http://i164.photobucket.com/albums/u8/hemi1hemi/COLOR/COL9-6.jpg" alt="..." height=100 width=100/>
</div>
<div class="gallery-list-item">
<img src="http://i164.photobucket.com/albums/u8/hemi1hemi/COLOR/COL9-6.jpg" alt="..." height=100 width=100/>
<img src="http://i164.photobucket.com/albums/u8/hemi1hemi/COLOR/COL9-6.jpg" alt="..." height=100 width=100/>
<img src="http://i164.photobucket.com/albums/u8/hemi1hemi/COLOR/COL9-6.jpg" alt="..." height=100 width=100/>
<img src="http://i164.photobucket.com/albums/u8/hemi1hemi/COLOR/COL9-6.jpg" alt="..." height=100 width=100/>
</div>
</div>
Hope it helps

Related

Responsive height of images on resize

I'm really stuck with responsive images short story I'm trying to make a simple grid like this
https://avenue-demo.squarespace.com
in this avenue website all the images have the same height and width when you resize the browser the images are resizing fine now here is my code
<ul class="grid">
<li>
<a href="">
<img src="https://images.unsplash.com/photo-1546725923-697533ae284d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=934&q=80" alt="">
</a>
</li>
<li>
<a href="">
<img src="https://images.unsplash.com/photo-1546934164-73ef3631f62d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=933&q=80" alt="">
</a>
</li>
<li>
<a href="">
<img src="https://images.unsplash.com/photo-1547014751-2b43a527b6fa?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1100&q=80" alt="">
</a>
</li>
</ul>
css :
.grid {
display: flex;
max-width: 1100px;
justify-content: space-between;
margin: 0 auto;
list-style: none;
}
.grid li {
width: 30%;
}
img {
max-width: 100%;
}
the problem is the images are not the same height when I set the height of the img to height 100% yes the images do have the same height but on resize they are shrinking not resizing like this website I posted, how can I fix it ?
As per my understanding you need to have square images to get the shown responsiveness, even though i have made some css changes to your code, to look like the images from website (which is not suggested always)
here is the code pen link
https://codepen.io/avreddy/pen/vvabbP
.grid {
display: flex;
max-width: 1100px;
justify-content: space-between;
margin: 0 auto;
list-style: none;
}
.grid li {
width: 30%;
}
.grid li a{
position: relative;
width: 100%;
padding: 50% 0;
display : block;
}
.grid li a img{
position: absolute;
width : 100%;
top: 0;
left: 0;
height: 100%;
object-fit : cover;
}
img {
max-width: 100%;
}
<ul class="grid">
<li>
<a href="">
<img src="https://images.unsplash.com/photo-1546725923-697533ae284d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=934&q=80" alt="">
</a>
</li>
<li>
<a href="">
<img src="https://images.unsplash.com/photo-1546934164-73ef3631f62d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=933&q=80" alt="">
</a>
</li>
<li>
<a href="">
<img src="https://images.unsplash.com/photo-1547014751-2b43a527b6fa?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1100&q=80" alt="">
</a>
</li>
</ul>

html css img resolution manipulation

I just started working on html and css and need to understand how I can fix the below issue:
I have the following section in my html body
.section-meals {
padding: 0;
background-color: #f4f4f4;
}
.meals-showcase {
list-style: none;
width: 100%;
}
.meals-showcase li {
display: block;
float: left;
width: 25%;
}
.meal-photo {
width: 100%;
margin: 0;
overflow: hidden;
background-color: #000;
}
.meal-photo img {
/*
Width 100% + height auto set to show up the entire image in a bounded area.
This is similar to wrap content height and width in android and iOS.
*/
width: 100%;
height: 100%;
/*
Made everything bigger, but now the images are bigger than the container themselves.
So we have to hide the overflow in the container with the property hidden.
*/
transform: scale(1.30);
transition: transform 0.5s, opacity 0.5s;
opacity: 0.6;
}
.meal-photo img:hover {
opacity: 1;
transform: scale(1.03);
}
<section class="section-meals">
<ul class="meals-showcase clearfix">
<li>
<figure class='meal-photo'>
<img src="resources/img/1.jpg" alt='passport photo'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="resources/img/2.jpg" alt='world map'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="resources/img/3.jpg" alt='globe in hand'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="resources/img/4.jpg" alt='taj mahal'>
</figure>
</li>
</ul>
<ul class="meals-showcase clearfix">
<li>
<figure class='meal-photo'>
<img src="resources/img/5.jpg" alt='cliff with beautiful houses'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="resources/img/6.jpg" alt='eiffel tower'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="resources/img/7.jpg" alt='Maya bay'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="resources/img/8.jpg" alt='beach'>
</figure>
</li>
</ul>
</section>
Now when this is rendered on the webpage. I see white spaces. because my images are all of different resolution. How can I ensure that all elements in the li stick to each other with image filling the box so that it looks alright. The above works fine if all images are of the same resolution.
Code reference is from a udemy course I have picked up. but I am trying my own scenarios.
How this appears:
When all images are same resolution, this appears like, but I want a similar effect:
You can use the padding top trick to give your li an aspect ratio, then use object fit to make your image fit perfectly (you will also need an ie polyfill for object fit):
body {
margin:0;
}
.meals-showcase {
/* reset list styles and use flex to line up in a row */
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-wrap: wrap;
}
.meals-showcase>li {
/* make li 25% width */
max-width: 25%;
width: 25%;
margin: 0;
padding: 0;
}
.meals-showcase figure {
/* make figure into block and relative position, give this the aspect ratio - here I use 75% padding top */
display: block;
width: 100%;
position: relative;
margin: 0;
padding: 75% 0 0 0;
}
.meals-showcase img {
object-fit: cover; /* add this */
display: block;
position: absolute; /* this is so it fills the figure */
width:100%;
height:100%;
top: 0;
left: 0;
transition: transform 0.5s;
}
.meal-photo img:hover {
transform: scale(1.05);
}
.meals-showcase figure:hover {
z-index:1; /* bring hover figure to front */
}
<section class="section-meals">
<ul class="meals-showcase clearfix">
<li>
<figure class='meal-photo'>
<img src="https://www.fillmurray.com/400/300" alt='passport photo'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="https://www.fillmurray.com/200/350" alt='world map'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="https://www.fillmurray.com/250/300" alt='globe in hand'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="https://www.fillmurray.com/300/300" alt='taj mahal'>
</figure>
</li>
</ul>
<ul class="meals-showcase clearfix">
<li>
<figure class='meal-photo'>
<img src="https://www.fillmurray.com/300/400" alt='cliff with beautiful houses'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="https://www.fillmurray.com/200/300" alt='eiffel tower'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="https://www.fillmurray.com/200/400" alt='Maya bay'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="https://www.fillmurray.com/200/500" alt='beach'>
</figure>
</li>
</ul>
</section>
This happens because indeed, the images are of different sizes. In many modern websites images are processed (thumbnailed) to be an exact size, this should avoid these issues in the first place. However, having a fail save CSS technique is a good idea.
Start off with determining the required size/aspect ratio of the images and set it in your stylesheet. This wil distort certain images that get "stretched" this effect can be cancelled by using object-fit: cover which will make sure the images covers the entire box (even if certain parts will be lost at the edges).
Actually to make object-fit work properly, the image container must have dimensions. In the following snippet, uncommenting /*height: 320px;*/ is enough to make it work. Of course, this dimension is static and must be the one of the smallest picture in a row.
If you want a full dynamic trick that adapts itself to the smallest picture for each row instead of specifying a given height or ratio, you can still use javascript. I made here a quick example that dynamically gets the smallest height and applies it to the elements (in jQuery).
function resizeMealPhotos(){
$('.meals-showcase').each(function(){
var h = Infinity;
$(this).find('.meal-photo').each(function(){
$(this).css('height', 'auto');
});
$(this).find('.meal-photo').each(function(){
var h2;
if( (h2 = $(this).height()) < h){
h = h2;
}
});
$(this).find('.meal-photo').each(function(){
$(this).css('height', h + 'px');
});
});
}
$(document).ready(function(){
resizeMealPhotos();
});
$(window).on('resize', resizeMealPhotos);
.section-meals {
padding: 0;
background-color: #f4f4f4;
}
.meals-showcase {
list-style: none;
width: 100%;
}
.meals-showcase li {
display: block;
float: left;
width: 25%;
}
.meal-photo {
width: 100%;
/*height: 320px;*/
margin: 0;
overflow: hidden;
background-color: #000;
}
.meal-photo img {
/*
Width 100% + height auto set to show up the entire image in a bounded area.
This is similar to wrap content height and width in android and iOS.
*/
width: 100%;
height: 100%;
object-fit: cover;
/*
Made everything bigger, but now the images are bigger than the container themselves.
So we have to hide the overflow in the container with the property hidden.
*/
transform: scale(1.30);
transition: transform 0.5s, opacity 0.5s;
opacity: 0.6;
}
.meal-photo img:hover {
opacity: 1;
transform: scale(1.03);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<section class="section-meals">
<ul class="meals-showcase clearfix">
<li>
<figure class='meal-photo'>
<img src="https://placeimg.com/640/480/any" alt='passport photo'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="https://placeimg.com/640/400/any" alt='world map'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="https://placeimg.com/640/420/any" alt='globe in hand'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="https://placeimg.com/480/480/any" alt='taj mahal'>
</figure>
</li>
</ul>
<ul class="meals-showcase clearfix">
<li>
<figure class='meal-photo'>
<img src="https://placeimg.com/480/480/any" alt='cliff with beautiful houses'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="https://placeimg.com/640/480/any" alt='eiffel tower'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="https://placeimg.com/640/320/any" alt='Maya bay'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="https://placeimg.com/640/400/any" alt='beach'>
</figure>
</li>
</ul>
</section>
try below code snippet.
can try different size in https://picsum.photos/120/300/?random
.section-meals {
padding: 0;
background-color: #f4f4f4;
margin: 0;
}
.meals-showcase {
list-style: none;
width: 100%;
}
.meals-showcase li {
display: inline-block;
float: left;
width: 25%;
}
.meal-photo {
width: 100%;
height: 100px;
position: relative;
overflow: hidden;
margin: 0;
}
.meal-photo img {
display: block;
width: 100%;
height: 100%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(1.12);
transition: transform 0.35s;
}
.meal-photo img:hover {
opacity: 1;
transform: translate(-50%, -50%) scale(1);
}
<section class="section-meals">
<ul class="meals-showcase clearfix">
<li>
<figure class='meal-photo'>
<img src="https://picsum.photos/80/100/?random
" alt='passport photo'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="https://picsum.photos/106/130/?random
" alt='world map'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="https://picsum.photos/114/90/?random
" alt='passport photo'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="https://picsum.photos/90/100/?random
" alt='taj mahal'>
</figure>
</li>
</ul>
<ul class="meals-showcase clearfix">
<li>
<figure class='meal-photo'>
<img src="https://picsum.photos/144/360/?random
" alt='passport photo'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="https://picsum.photos/130/300/?random
" alt='eiffel tower'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="https://picsum.photos/140/300/?random
" alt='Maya bay'>
</figure>
</li>
<li>
<figure class='meal-photo'>
<img src="https://picsum.photos/120/300/?random
" alt='beach'>
</figure>
</li>
</ul>
</section>

Equal Height images in Flexbox layout

This is easier to show in an image- http://puu.sh/n8WGw/0b01b020c7.png
I want the flex container to shrink as it's doing now, to match the height of the largest image, but I want the other images to match the height of the flex container. Whenever I try, they just become full height (their original height). Is there a way to accomplish this?
If I've not explained it well enough - I want the images to take up 100% of their li parent height, as shown by the blue box in the image attached.
We do not know what you did really, maybe overused flexbox rules ?
ul {
display: flex;
}
li {
list-style-type: none;
}
img {
height: 100%;/* in flex-child, the tallest will set rythm ... here it's about 200px; + gap height underneath if no reset of display or vertical-align */
}
<ul>
<li>
<img src="http://lorempixel.com/g/400/100/" alt="" />
</li>
<li>
<img src="http://lorempixel.com/g/400/200/" alt="" />
</li>
<li>
<img src="http://lorempixel.com/g/300/150/" alt="" />
</li>
<li>
<img src="http://lorempixel.com/g/400/100/" alt="" />
</li>
</ul>
or if flex set on li
ul {
display: flex;
width: 100%;
padding: 0;
}
li {
flex: 1;
overflow: hidden;
/* img will be cut off */
}
img {
min-height: 100%;/* again , tallest should set the rythm */
min-width: 100%; /* unless one doesn't fit the width */
display: block;
}
<ul>
<li>
<img src="http://lorempixel.com/g/400/100/" alt="" />
</li>
<li>
<img src="http://lorempixel.com/g/400/200/" alt="" />
</li>
<li>
<img src="http://lorempixel.com/g/300/150/" alt="" />
</li>
<li>
<img src="http://lorempixel.com/g/200/50/" alt="" />
</li>
</ul>

Horizontal div scroller without fixed width

I am trying to make a photogallery, the idea is that you have a horizontal(!) slider with all the images (and later on in the script you can click on them, but that is not important). The problem is that all the images do not fit in the layout, so that is why i need some kind of scroll mechanism. This is my HTML:
<section>
<div id="thumbnails">
<div>
<ul>
<li><img></li>
<li><img></li>
.............
<li><img></li>
<li><img></li>
</ul>
</div>
</div>
</section>
And this is my CSS:
div#thumbnails { margin: 0; padding: 0; overflow: auto; }
div#thumbnails * { margin: 0; padding: 0; }
div#thumbnails div { width: 20000px; }
div#thumbnails ul { list-style: none; }
div#thumbnails ul li { display: inline-block; }
section { width: 960px; }
This more or less works like a breeze, except for the fact that the slider is filled with whitespace (obviously due to the width of 20000px;). However, that width of 20000px is nessecary, else the wrapper div wil take the same width as div#thumbnails, and that width is of course 960px (due to the section-tag). The result of that is that the list will get extra rows, and i obvously want only 1 row. So ideally, the wrapper div should get the exact same width as the dynamic list, but i am stuck here. Somebody has an idea how to fix this (preferably without jQuery/JS, it's not very difficult to solve it with javascript)?
Is this what you're looking for?
div#thumbnails {
margin: 0;
padding: 0;
overflow: auto;
}
div#thumbnails * {
margin: 0;
padding: 0;
}
div#thumbnails div {
white-space: nowrap;
}
div#thumbnails ul {
list-style: none;
}
div#thumbnails ul li {
display: inline-block;
}
section {
width: 960px;
}
<section>
<div id="thumbnails">
<div>
<ul>
<li>
<img src="http://placehold.it/150x150">
</li>
<li>
<img src="http://placehold.it/150x150">
</li>
<li>
<img src="http://placehold.it/150x150">
</li>
<li>
<img src="http://placehold.it/150x150">
</li>
<li>
<img src="http://placehold.it/150x150">
</li>
<li>
<img src="http://placehold.it/150x150">
</li>
<li>
<img src="http://placehold.it/150x150">
</li>
<li>
<img src="http://placehold.it/150x150">
</li>
<li>
<img src="http://placehold.it/150x150">
</li>
<li>
<img src="http://placehold.it/150x150">
</li>
<li>
<img src="http://placehold.it/150x150">
</li>
<li>
<img src="http://placehold.it/150x150">
</li>
</ul>
</div>
</div>
</section>

Where to put the sizing css? In li, a, or img?

I am making an mobile web app, and I ran into this problem.
Currently my code is structured as follows:
<ul class="app-lst">
<li class="item-1">
<a href="#">
<img src="img1.jpg" alt="img">
</a>
</li>
<li class="item-2">
<a href="#">
<img src="img2.jpg" alt="img">
</a>
</li>
... etc.
</ul>
CSS:
.item-1 {
width: 90%;
height: 10%;
}
.app-lst li a {
background-color: red;
}
.app-lst li a img {
}
Below image is the result I am trying to get. As you can see from the code above, Each boxes are <li>, and under it, there is <a> and under the link there is the content.
How would I go about with this for CSS?
-Should i adjust the box's size by putting width and height on <li> or <a>?
-Should i set the box's color by putting background-color on <a>?
-And finally, the image does not adjust to fit inside the parent <a>, so it extends the whole box if the image is larger. I tried putting "max-width: 100%" on the image, but no luck.
Also, since it is a mobile design I am controlling all the sizes with percentages. is this a good practice or should I do it with pixels?
Thank you so much in advance for your help!
You will need to use your <ul> as a container that is set to 100% height/width, and then size your <li> elements based on that. Then finally, make your <img> elements 100% height and width.
HTML
<ul class="app-lst">
<li class="item-1">
<a href="#">
<img src="http://placehold.it/150x150" alt="img"/>
</a>
</li>
<li class="item-2">
<a href="#">
<img src="http://placehold.it/150x150" alt="img"/>
</a>
</li>
<li class="item-3">
<a href="#">
<img src="http://placehold.it/150x150" alt="img"/>
</a>
</li>
<li class="item-4">
<a href="#">
<img src="http://placehold.it/150x150" alt="img"/>
</a>
</li>
<li class="item-5">
<a href="#">
<img src="http://placehold.it/150x150" alt="img"/>
</a>
</li>
</ul>
CSS
.app-lst {
display: block;
height: 500px;
list-style-type: none;
margin: 0;
padding: 0;
}
.app-lst li {
display: inline-block;
float: left;
margin: 0;
padding: 0;
}
.item-1, .item-2 {
height: 75%;
}
.item-1 {
width: 75%;
}
.item-2 {
width: 25%;
}
.item-3, .item-4, .item-5 {
height: 25%;
}
.item-3 {
width: 10%;
}
.item-4 {
width: 20%;
}
.item-5 {
width: 70%;
}
.app-lst li img {
height: 100%;
width: 100%;
}
JSFiddle: http://jsfiddle.net/b6x1byfp/