I am trying to implement Chris Coyier's example of using CSS columns to create a seamless responsive grid of images.
I put Chris's files onto my server and everything looked fine. The only thing I changed was the actual images.
Now, as you see on my test page, there are only 4 columns of images instead of the specified 5, using column-count:5;
. The fifth column is just whitespace with no content.
This only happens when the browser window is greater than 1200px. When the browser window is less than 1200px, the media queries kick in and decreases the column count 4, 3, 2, and finally 1. In other words, this bug only happens when the column-count:
is 5 and up
This happens in FF 10, Chrome 17+, and Safari 5+.
Any help would be appreciated!
Here is the trimmed HTML:
<section id="photos">
<img src="images/iso_o.jpg" alt="Isometric" />
<img src="images/iso_o.jpg" alt="Isometric" />
<img src="images/iso_o.jpg" alt="Isometric" />
<img src="images/iso_o.jpg" alt="Isometric" />
<img src="images/iso_o.jpg" alt="Isometric" />
<img src="images/iso_o.jpg" alt="Isometric" />
...
</section>
Here is the untouched CSS:
* { margin: 0; padding: 0; }
#photos {
/* Prevent vertical gaps */
line-height: 0;
-webkit-column-count: 5;
-webkit-column-gap: 0px;
-moz-column-count: 5;
-moz-column-gap: 0px;
column-count: 5;
column-gap: 0px;
}
#photos img {
/* Just in case there are inline attributes */
width: 100% !important;
height: auto !important;
}
@media (max-width: 1200px) {
#photos {
-moz-column-count: 4;
-webkit-column-count: 4;
column-count: 4;
}
}
@media (max-width: 1000px) {
#photos {
-moz-column-count: 3;
-webkit-column-count: 3;
column-count: 3;
}
}
@media (max-width: 800px) {
#photos {
-moz-column-count: 2;
-webkit-column-count: 2;
column-count: 2;
}
}
@media (max-width: 400px) {
#photos {
-moz-column-count: 1;
-webkit-column-count: 1;
column-count: 1;
}
}
column-count:7
andcolumn-count:10
work correctly. I still need to find out whycolumn-count:5
doesn't work. – Saker