I have been researching and experimenting with HTML5 and CSS3. I was aiming to create a very simple but efficient tiled gallery / grids. So some sort of grid system that I can layout anything inside.
Below is what I have created, what are your opinions? I also have a question, why the distributing of the images change from browser to another? Is there a way to control it?
Here is a working Fiddle.
HTML:
<div class="grids">
<div class="gridElement">
<img alt="image" src="assets/images/image.jpg">
</div>
<div class="gridElement">
<img alt="image" src="assets/images/image.jpg">
</div>
<div class="gridElement">
<img alt="image" src="assets/images/image.jpg">
</div>
<div class="gridElement">
<img alt="image" src="assets/images/image.jpg">
</div>
<div class="gridElement">
<img alt="image" src="assets/images/image.jpg">
</div>
<div class="gridElement">
<img alt="image" src="assets/images/image.jpg">
</div>
</div>
CSS:
/*Grids System*/
.grids {
width: 100%;
overflow: hidden;
-webkit-column-count: 3;
-moz-column-count: 3;
column-count: 3;
-webkit-column-gap: 10px;
-moz-column-gap: 10px;
column-gap: 10px;
}
.grids.twoGrids {
-webkit-column-count: 2;
-moz-column-count: 2;
column-count: 2;
}
.grids.fourGrids {
-webkit-column-count: 4;
-moz-column-count: 4;
column-count: 4;
}
.grids .gridElement {
margin-bottom: 10px;
overflow: hidden;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
}
.grids .gridElement:last-child {
margin-bottom: 0;
}
.grids .gridElement img {
min-width: 100%;
}