Skip to content

Instantly share code, notes, and snippets.

@nladart
Created September 6, 2013 07:32
Show Gist options
  • Save nladart/6460649 to your computer and use it in GitHub Desktop.
Save nladart/6460649 to your computer and use it in GitHub Desktop.
Full Width Image Grid

Full Width Image Grid

An example of an image grid where the images expand to always cover the entire width of the page while staying in rows of three with minimal (ideally no) space in between. I will have a live example of this soon in a site I'm doing.

A Pen by Nick LaDart on CodePen.

License.

<section>
<ul>
<li><img src="http://placehold.it/900x650/000/CFCFCF"></li>
<li><img src="http://placehold.it/900x650/000/CFCFCF"></li>
<li><img src="http://placehold.it/900x650/000/CFCFCF"></li>
<li><img src="http://placehold.it/900x650/000/CFCFCF"></li>
<li><img src="http://placehold.it/900x650/000/CFCFCF"></li>
<li><img src="http://placehold.it/900x650/000/CFCFCF"></li>
<li><img src="http://placehold.it/900x650/000/CFCFCF"></li>
<li><img src="http://placehold.it/900x650/000/CFCFCF"></li>
<li><img src="http://placehold.it/900x650/000/CFCFCF"></li>
</ul>
</section>
ul {
display: table;
width: 100%;
height: auto;
margin: 0;
padding: 0;
}
li {
display: table-cell;
width: 33%;
height: auto;
text-decoration: none;
list-style-type: none;
float: left;
margin-top: -4px;
border: 1px solid #eee;
}
img {
width: 100%;
height: auto;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment