I need a gallery of images. Thereby it should be responsive. When there are too many images for one line, they should be displayed in the next. That's what I have already implemented. My problem now is that the last line (when it has just one image for example) is centered, too. But It should be floated left.
I tried float:left
, but this just makes everything float left and not center anymore.
Here is an JSFiddle-Example.
How can I have the last image float left?
HTML:
<div class="psAppWrapper">
<div ng-repeat="app in applications track by $index" class="psAppTile">
<img src="{{app.icon}}" class="psAppIcon"/>
<p class="psAppTitle">{{app.title}}</p>
</div>
</div>
CSS:
.psAppIcon {
width: 80px;
height: 80px;
}
.psAppTitle {
text-align: center;
}
.psAppTile {
width: 80px;
display: inline-block;
margin-left: 10px;
margin-right: 10px;
}
.psAppWrapper {
width: 100%;
text-align:center;
}
EDIT
When I add float left it looks like this:
The red one is psAppWrapper
. Here you can see that the images are not centered. The left ones have much less space to the left than the right ones to the right. The spaces should be the same.