I have an image gallery within a div
element named "container" with a specified width:70%
. I need the images to be justified with auto margins.
This is the HTML code I am using: (There are 4 images in total)
<div class="container">
<ul class="grid gallery">
<li class="animation-element">
<figure>
<img src="http://s33.postimg.org/638l2frnz/google_logo.png" alt="GINIS">
<figcaption>
<h3>Name</h3>
<span>Description</span>
</figcaption>
</figure>
</li>
</div>
Below is the CSS code that accompanies the HTML:
.grid {
width:100%;
margin: 0 auto;
list-style: none;
text-align:left;}
.grid li {
border:1px solid blue;
box-shadow:0px 0px 1px #black;
display: inline-block;
width: 250px;
margin-bottom:20px;
font-family: "Ubuntu", sans-serif;
text-align: left;
position: relative;}
The above CSS code ensures that the (li) elements are properly justified.
You can view my code example here: http://codepen.io/anon/pen/QEybgL